#include <bits/stdc++.h>
using namespace std;
vector<double> ans;
vector<int> v;
int a, b;
int main() {
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  for (int i = 0; i < a; i++) {
    int p = v[i] + b;
    int idx = lower_bound(v.begin(), v.end(), p) - v.begin();
    if (idx >= a) {
      if (v[a - 1] <= p) idx = a - 1;
    } else {
      if (v[idx] > p) idx--;
    }
    if (idx - i >= 2 && idx < a) {
      double pp = v[i];
      double q = v[i + 1];
      double r = v[idx];
      double tt = (r - q);
      tt = tt / (r - pp);
      ans.push_back(tt);
    }
  }
  sort(ans.begin(), ans.end());
  if (ans.size() == 0)
    cout << "-1" << endl;
  else
    printf("%.9f\n", ans[ans.size() - 1]);
}
