#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  int n, U;
  cin >> n >> U;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  double ans = -1;
  for (int i = 1, j = 1; i + 1 <= n; ++i) {
    while (j + 1 <= n and a[j + 1] - a[i] <= U) ++j;
    if (j - i + 1 < 3) continue;
    ans = max(ans, (double)(a[j] - a[i + 1]) / (a[j] - a[i]));
  }
  cout << fixed << setprecision(9) << ans << '\n';
}
