#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, u;
  cin >> n >> u;
  long long temp;
  long long ji, ki, kj, upper;
  vector<long long>::iterator u1;
  vector<float> effi;
  int ct = 1;
  vector<long long> ene;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    ene.push_back(temp);
  }
  double ans = 0;
  for (int i = 0; i < n - 2; i++) {
    upper = ene[i] + u;
    u1 = upper_bound(ene.begin(), ene.end(), upper);
    int index = u1 - ene.begin() - 1;
    ki = ene[index] - ene[i];
    kj = ene[index] - ene[i + 1];
    double ef = ((double)kj / (double)ki);
    ans = max(ef, ans);
  }
  if (ans != 0) {
    printf("%0.20f", ans);
  } else
    cout << -1;
  return 0;
}
