#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n, u;
  cin >> n >> u;
  vector<long double> e(n);
  for (int i = 0; i < n; ++i) cin >> e[i];
  long double best = 0;
  bool isthere = false;
  for (int i = 0; i < n - 2; i++) {
    int j = i + 1;
    if (e[j + 1] - e[i] > u) continue;
    int l = j + 1;
    int r = n;
    while (l < r - 1) {
      int mid = (l + r) / 2;
      if (e[mid] - e[i] > u)
        r = mid;
      else
        l = mid;
    }
    isthere = true;
    best = max(best, (e[l] - e[j]) / (e[l] - e[i]));
  }
  cout.precision(15);
  cout << fixed;
  if (!isthere)
    cout << -1;
  else
    cout << best;
}
