#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  long long k;
  cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int l;
  double d, ans = -1;
  for (int i = 0; i < n - 2; i++) {
    l = lower_bound(a, a + n, a[i] + k) - a;
    if (l >= n) l = n - 1;
    if (a[l] - a[i] > k) l--;
    if (l - i < 2)
      continue;
    else {
      d = a[l] - a[i + 1];
      d /= (a[l] - a[i]);
      ans = max(ans, d);
    }
  }
  if (ans == -1)
    cout << -1;
  else
    cout << fixed << setprecision(12) << ans;
  return;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
