#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const long long llinf = (long long)9e18;
const int N = (int)2e5 + 111;
const long double PI = (long double)acos(-1);
int main() {
  long double ans = -1;
  int n, u;
  scanf("%d %d", &n, &u);
  vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int i1 = 0, i2 = 0;
  for (; i1 < n; i1++) {
    while (i2 < n && a[i2] - a[i1] <= u) i2++;
    i2--;
    if (i2 - i1 + 1 < 3) continue;
    ans = max(ans,
              (long double)(a[i2] - a[i1 + 1]) / (long double)(a[i2] - a[i1]));
  }
  printf("%.11Lf", ans);
  return 0;
}
