#include <bits/stdc++.h>
using namespace std;
int main() {
  long double n, u;
  cin >> n >> u;
  vector<long double> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  long double a = -1, b = -1, c = -1;
  long double diff = -1;
  int j = 0;
  for (int i = 0; i <= n - 3; ++i) {
    j = max(j, i + 2);
    while (v[j] - v[i] <= u && j <= n - 1) ++j;
    --j;
    if (i + 1 >= j) continue;
    if (v[j] - v[i] == 0) {
      if (diff == -1) diff = 0;
      continue;
    }
    if (v[j] - v[i] <= u && (v[j] - v[i + 1]) / (v[j] - v[i]) > diff) {
      a = v[i];
      b = v[i + 1];
      c = v[j];
      diff = (v[j] - v[i + 1]) / (v[j] - v[i]);
    }
  }
  if (diff == -1) {
    cout << -1 << endl;
    return 0;
  }
  cout.precision(19);
  cout << diff << endl;
  return 0;
}
