#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
const int INF = 0x3f3f3f3f, MOD = 1000000007;
const long long LINF = LONG_LONG_MAX;
int a[MAXN];
signed main() {
  cin.tie(0);
  cout.sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  for (int i = (0); i < (n); i += 1) cin >> a[i];
  int f = 0;
  double ans = -1;
  for (int i = (0); i < (n - 2); i += 1) {
    while (a[f] - a[i] <= k && f < n) f++;
    f--;
    if (f - i < 2) continue;
    ans = max(ans, 1.0 * (a[f] - a[i + 1]) / (a[f] - a[i]));
  }
  cout << fixed << setprecision(10) << ans << '\n';
}
