#include <bits/stdc++.h>
using namespace std;
long long int n, u, a[300001], x, y;
long double ans = -1.0;
int main() {
  cin >> n >> u;
  for (int i = 0; i < n; ++i) cin >> a[i];
  y = 1;
  while (x < n - 2) {
    while (y < n - 1 && a[y + 1] - a[x] <= u) ++y;
    if (y - x >= 2 && a[y] - a[x] <= u)
      ans =
          max(ans, (long double)(a[y] - a[x + 1]) / (long double)(a[y] - a[x]));
    ++x;
  }
  printf("%.9Lf\n", ans);
  return 0;
}
