#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 10;
long double n, u;
vector<long double> a(N);
bool check(long long x, long long i) {
  if (a[x] - i < u)
    return 1;
  else
    return 0;
}
int32_t main() {
  cin >> n >> u;
  a.resize(n);
  long double ans = -1;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n - 2; i++) {
    long long l = 0;
    long long r = n;
    long long temp = a[i];
    temp++;
    while (r > l) {
      long long mid = (l + r) >> 1;
      if (check(mid, temp))
        l = mid + 1;
      else
        r = mid;
    }
    l--;
    if (a[l] != a[i] and a[l] != a[i + 1])
      ans = max(ans, (a[l] - a[i + 1]) / (a[l] - a[i]));
  }
  cout << fixed << setprecision(15) << ans;
}
