#include <bits/stdc++.h>
using namespace std;
mt19937 mt_rand(chrono::system_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, u;
  cin >> n >> u;
  vector<int> e(n);
  for (int i = 0; i < n; i++) {
    cin >> e[i];
  }
  long double ans = -1;
  bool any = false;
  for (int i = 0; i + 2 < n; i++) {
    if (e[i + 2] - e[i] > u) {
      continue;
    }
    int ptr = i + 2;
    for (int sh = 65536; sh; sh >>= 1) {
      if (ptr + sh < n && e[ptr + sh] - e[i] <= u) {
        ptr += sh;
      }
    }
    any = true;
    ans = max(ans,
              (long double)(e[ptr] - e[i + 1]) / (long double)(e[ptr] - e[i]));
  }
  if (!any) {
    cout << "-1\n";
  } else {
    cout << fixed << setprecision(20) << ans << "\n";
  }
  return 0;
}
