#include <bits/stdc++.h>
using namespace std;
const int mm = 2e5 + 100;
long long int d[mm];
int main() {
  long long int n, m, i, j, t, a, b, c, p, k, kk;
  scanf("%lld%lld", &n, &m);
  for (i = 1; i <= n; i++) scanf("%lld", &d[i]);
  double ans = -1;
  long long int r, l;
  d[n + 1] = 0x3f3f3f3f3f3f3f3f;
  for (r = 3, l = 1; l <= n; l++) {
    while (d[r] - d[l] <= m) {
      r++;
    }
    if (r - l >= 3 && (d[r - 1] - d[l] <= m)) {
      double o = (d[r - 1] - d[l + 1]) * 1.0 / (d[r - 1] * 1.0 - d[l]);
      ans = max(o, ans);
    }
  }
  if (ans == -1)
    cout << -1 << endl;
  else
    printf("%.9lf\n", ans);
}
