#include <bits/stdc++.h>
using namespace std;
int E[200001];
int main() {
  int n, u;
  scanf("%d %d", &n, &u);
  for (int ni = 0; ni < n; ni++) scanf("%d", &E[ni]);
  int t = 0;
  double ans = -1;
  for (int h = 0; h < n; h++) {
    while (t < n && E[t] - E[h] <= u) t++;
    if (t < h + 3) continue;
    ans = max(ans, (double)(E[t - 1] - E[h + 1]) / (E[t - 1] - E[h]));
  }
  printf("%.12f\n", ans);
}
