#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  while (cin >> n >> k) {
    vector<int> num(n);
    for (int i = 0; i < n; i++) cin >> num[i];
    bool valid = false;
    double maxv = 0;
    for (int i = 0; i < n - 2; i++) {
      int l = i + 2, r = n - 1;
      while (r > l) {
        const int m = (l + r + 1) >> 1;
        if (num[m] - num[i] > k)
          r = m - 1;
        else
          l = m;
      }
      if (num[r] - num[i] <= k) {
        valid = true;
        maxv = max(maxv, double(num[r] - num[i + 1]) / double(num[r] - num[i]));
      }
    }
    cout << setprecision(12) << (valid ? maxv : -1) << endl;
  }
  return 0;
}
