#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  long double u;
  cin >> n >> u;
  vector<long double> e(n);
  for (int i = 0; i < n; i++) cin >> e[i];
  long double ans = 0;
  bool fl = 0;
  for (int i = 2; i < n; i++) {
    if (e[i] - e[i - 2] <= u) fl = 1;
  }
  if (!fl) {
    cout << "-1" << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int tmp = upper_bound(e.begin(), e.end(), e[i] + u) - e.begin() - 1;
    if (tmp - i < 2) continue;
    ans = max(ans, (e[tmp] - e[i + 1]) / (e[tmp] - e[i]));
  }
  cout << fixed << setprecision(13) << ans << endl;
}
