#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a;
  int x, n;
  cin >> n;
  int u;
  double ma = -2.5;
  cin >> u;
  for (int i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
  vector<int>::iterator it;
  for (int j = 1; j < n - 1; j++) {
    int constraint = a[j - 1] + u;
    it = upper_bound(a.begin(), a.begin() + n, constraint);
    it--;
    int val = *it;
    if (val <= a[j]) continue;
    int denom = val - a[j - 1];
    double eff = 1LL * (val - a[j]) / (double)denom;
    ma = max(eff, ma);
  }
  if (ma == -2.5)
    cout << -1;
  else
    cout << setprecision(15) << ma;
  return 0;
}
