#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, u;
  cin >> n >> u;
  vector<double> E;
  double e;
  for (int i = 0; i < n; i++) {
    cin >> e;
    E.push_back(e);
  }
  double ans = 0;
  for (int i = 0; i < E.size(); i++) {
    double l = E[i];
    double r = E[i] + u;
    long long low = lower_bound(E.begin() + i, E.end(), r) - E.begin();
    if (low == E.size() or E[low] != r) {
      low--;
    }
    if ((low - i) >= 2) {
      double temp = (E[low] - E[i + 1]) / (E[low] - E[i]);
      if (temp > ans) {
        ans = temp;
      }
    }
  }
  if (ans == 0) {
    cout << "-1" << endl;
    return 0;
  }
  cout << setprecision(12) << ans << endl;
  return 0;
}
