#include <bits/stdc++.h>
using namespace std;
bool Pred(string a, string b) {
  if (a == b) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(18);
  int t;
  t = 1;
  while (t--) {
    long double n, u;
    cin >> n >> u;
    vector<long double> a(n);
    long double ans = 0;
    for (long double i = 0; i < n; i++) cin >> a[i];
    for (long double i = 1; i < n; i++) {
      long double q1 = a[i] - a[i - 1];
      if (q1 > u) continue;
      vector<long double>::iterator low;
      low = std::lower_bound(a.begin(), a.end(), a[i - 1] + u);
      if (low == a.end()) low = a.end() - 1;
      long double q2 = a[low - a.begin()];
      if (q2 - a[i - 1] > u) q2 = a[low - a.begin() - 1];
      if (q2 == 0 || q2 == a[i] || q2 == a[i - 1]) continue;
      long double q3 = (q2 - a[i]) / (q2 - a[i - 1]);
      ans = max(ans, q3);
    }
    if (!ans > 0)
      cout << -1 << endl;
    else
      cout << ans << endl;
  }
  return 0;
}
