#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, u;
  cin >> n >> u;
  int a[n + 1];
  for (int i = 1, _b = (n); i <= _b; i++) cin >> a[i];
  double res = -1;
  for (int i = 1, _b = (n - 2); i <= _b; i++) {
    int tmp = -1;
    int le = i, ri = n;
    while (le <= ri) {
      int m = (le + ri) / 2;
      if (a[m] - a[i] <= u) {
        tmp = m;
        le = m + 1;
      } else
        ri = m - 1;
    }
    if (tmp != -1 && tmp - i > 1) {
      res = max(res, (double)(a[tmp] - a[i + 1]) / (a[tmp] - a[i]));
    }
  }
  if (res != -1)
    cout << setprecision(10) << fixed << res << '\n';
  else
    cout << -1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int te = 1;
  while (te--) solve();
  return 0;
}
