#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 13;
int n, u;
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> n >> u;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  bool impossible = true;
  double res = 0;
  for (int i = 0, j = 0; i < n - 2; ++i) {
    j = max(j, i + 2);
    if (a[j] - a[i] > u) {
      continue;
    }
    impossible = false;
    while (j + 1 < n && a[j + 1] - a[i] <= u) {
      ++j;
    }
    res = max(res, (double)(a[j] - a[i + 1]) / (a[j] - a[i]));
  }
  if (impossible) {
    cout << -1;
    return 0;
  }
  cout << setprecision(20) << res;
  return 0;
}
