#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool flag = 0;
  double ans = 0;
  for (int i = 0; i < n - 2; i++) {
    long double x;
    int y;
    if (a[i] + m >= a[n - 1]) {
      x = a[n - 1];
      y = n - 1;
      if (y - i >= 2) {
        flag = 1;
        double ans1 = (x - a[i + 1]) / (x - a[i]);
        ans = max(ans1, ans);
      }
    } else {
      auto it = upper_bound(a, a + n, a[i] + m);
      if (*it > a[i] + m) {
        it--;
      }
      x = *it;
      y = it - a;
      if (y - i >= 2) {
        flag = 1;
        double ans1 = (x - a[i + 1]) / (x - a[i]);
        ans = max(ans1, ans);
      }
    }
  }
  if (flag == 1)
    printf("%.10f", ans);
  else
    cout << "-1";
  return 0;
}
