#include <bits/stdc++.h>
using namespace std;
int a[100100];
vector<int> s;
int main() {
  int n, u;
  cin >> n >> u;
  for (int i = 0; i < n; i++) cin >> a[i], s.push_back(a[i]);
  double ans = -1;
  for (int i = 0; i < n - 2; i++) {
    int x = a[i], y = a[i + 1];
    int pos = lower_bound(s.begin(), s.end(), x + u) - s.begin();
    if (pos == n) pos--;
    while (s[pos] - x > u) pos--;
    if (s[pos] <= x || s[pos] <= y) continue;
    ans = max(ans, (s[pos] - y) / 1.0 / (s[pos] - x));
  }
  if (ans == -1)
    cout << -1 << endl;
  else
    printf("%.9f\n", ans);
  return 0;
}
