#include <bits/stdc++.h>
using namespace std;
const float eps = 1e-6;
long long mod = 1000000007;
int main() {
  long long n, i, u;
  double fans = FLT_MIN;
  cin >> n >> u;
  long long E[n];
  for (i = 0; i < n; i++) cin >> E[i];
  for (i = 0; i < n - 2; i++) {
    long long a = i, b = i + 1;
    long long s = b + 1, e = n - 1;
    long long ind = upper_bound(E + i, E + n, E[a] + u) - E;
    ind--;
    if (ind >= a + 2)
      fans = max(fans, ((E[ind] - E[b]) * 1.0) / (E[ind] - E[a]));
  }
  if (fans != FLT_MIN)
    cout << setprecision(20) << fans << endl;
  else
    cout << "-1" << endl;
  return 0;
}
