#include <bits/stdc++.h>
using namespace std;
const int maxn = ((int)2e6) + 5;
int energy[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, u;
  cin >> n >> u;
  for (int i = 0; i < n; i++) cin >> energy[i];
  int curr = 2;
  double eff = -1;
  for (int i = 1; i < n - 1; i++) {
    int ei = energy[i - 1];
    int ej = energy[i];
    while (energy[curr] - ei > u) {
      curr--;
    }
    while (curr < n && energy[curr] - ei <= u) {
      eff = max(eff, (energy[curr] - ej) / (energy[curr] - ei + 0.0));
      curr++;
    }
    if (curr == n) curr--;
  }
  if (eff < 1e-7) {
    cout << -1;
  } else {
    cout << fixed << setprecision(9) << eff;
  }
  return 0;
}
