#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<double> a;
  double ans;
  int n, u, i, flag, e, lo;
  cin >> n >> u;
  for (i = 0; i < n; i++) {
    cin >> e;
    a.push_back((double)e * 1.0);
  }
  sort(a.begin(), a.end());
  for (i = 0, ans = 0.0, flag = 0; i < n; i++) {
    lo = upper_bound(a.begin(), a.end(), a[i] + u) - a.begin();
    lo--;
    if (lo - i > 1 && lo >= 0 && a[lo] != a[i] && a[lo] != a[i + 1]) {
      flag = 1;
      ans = max(ans, ((a[lo] - a[i + 1]) * 1.0) / ((a[lo] - a[i]) * 1.0));
    }
  }
  if (flag)
    cout << setprecision(15) << ans << endl;
  else
    cout << "-1" << endl;
  return 0;
}
