#include <bits/stdc++.h>
using namespace std;
double f(int i, int x, vector<int>& e) {
  int a = e[x] - e[i], b = e[x] - e[i + 1];
  return (double)b / a;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, u;
  cin >> n >> u;
  vector<int> e(n);
  for (int i = 0; i < n; i++) cin >> e[i];
  double max_z = 0;
  bool bb = false;
  for (int i = 0; i < n - 2; i++) {
    int l = i + 2;
    int r = upper_bound(e.begin() + i + 2, e.end(), e[i] + u) - e.begin() - 1;
    while (r - l > 3) {
      int m1 = l + (r - l) / 3, m2 = r - (r - l) / 3;
      if (f(i, m1, e) < f(i, m2, e))
        l = m1;
      else
        r = m2;
    }
    for (int j = l; j <= r; j++)
      if (f(i, j, e) > max_z) {
        max_z = f(i, j, e);
        bb = true;
      }
  }
  if (!bb)
    cout << -1;
  else
    cout << fixed << setprecision(10) << max_z;
}
