#include <bits/stdc++.h>
using namespace std;
const int INF = 1231231234;
const int MOD = 1000000007;
const long double EPS = .00001;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, u;
  cin >> n >> u;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool feasible = false;
  long double sol = 0.0;
  for (int l = 0, r = 0; l < n; l++) {
    while (r + 1 < n and a[l] >= a[r + 1] - u) r++;
    if (r - l >= 2) {
      sol = max(sol, (long double)(a[r] - a[l + 1]) / (a[r] - a[l]));
      feasible = true;
    }
  }
  if (feasible)
    cout << fixed << setprecision(11) << sol << '\n';
  else
    cout << -1 << '\n';
  return 0;
}
