#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int INF = 1e9 + 7;
void fail() {
  cout << "No\n";
  exit(0);
}
struct DD {
  ll up, down;
  DD(int u, int d) : up(u), down(d) {}
  bool operator<(const DD& other) { return up * other.down < down * other.up; }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, u;
  cin >> n >> u;
  vector<int> e(n);
  for (int& i : e) {
    cin >> i;
  }
  vector<DD> cases;
  cases.reserve(n);
  for (int i = 0; i < n - 2; ++i) {
    int j = i + 1;
    int l = j + 1;
    int r = n;
    while (l < r - 1) {
      int m = (l + r) / 2;
      if (e[m] - e[i] <= u) {
        l = m;
      } else {
        r = m;
      }
    }
    if (e[l] - e[i] <= u) {
      cases.emplace_back(e[j] - e[i], e[l] - e[i]);
    }
  }
  if (cases.size() == 0) {
    cout << "-1";
  } else {
    for (int i = 1; i < cases.size(); ++i) {
      if (cases[i] < cases[0]) {
        cases[0] = cases[i];
      }
    }
    double u = cases[0].up;
    double d = cases[0].down;
    cout << fixed << setprecision(15) << 1 - u / d << "\n";
  }
  return 0;
}
