#include <bits/stdc++.h>
using namespace std;
double ans;
int e[110000], u;
int n;
int main() {
  scanf("%d%d", &n, &u);
  int i, j, s, p, q;
  for (i = 0; i < n; i++) scanf("%d", &e[i]);
  j = 0;
  ans = -1;
  for (i = 0; i < n; i++) {
    while (j < n && e[i] + u >= e[j]) j++;
    if (j <= i + 2) continue;
    ans = max(ans, 1. * (e[j - 1] - e[i + 1]) / (e[j - 1] - e[i]));
  }
  printf("%.20f\n", ans);
  return 0;
}
