#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int a[maxn];
int n, u;
int main() {
  while (cin >> n >> u) {
    for (int i = 0; i < n; i++) cin >> a[i];
    int i = 0, k = i;
    double ans = -1;
    for (; i < n - 2; i++) {
      for (; k < n - 1 && a[k + 1] - a[i] <= u; k++)
        ;
      if (k - i >= 2) {
        ans = max(ans, 1 + 1.0 * (a[i] - a[i + 1]) / (a[k] - a[i]));
      }
    }
    printf("%.9lf\n", ans);
  }
  return 0;
}
