#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 10;
const int maxM = 2e5 + 10;
const int QSIZE = maxN;
const long long MOD = 1e9 + 7;
const int INF = 1e9;
const long long LINF = 8e18;
const int K = 100;
mt19937_64 gen;
inline long long random(long long l, long long r) {
  uniform_int_distribution<long long> dist(l, r);
  return dist(gen);
}
long long e[maxN];
int main() {
  int n;
  long long u;
  cin >> n >> u;
  for (int i = 0; i < n; i++) {
    cin >> e[i];
  }
  int opt = 2;
  long double ans = -1e9;
  for (int i = 0; i < n - 2; i++) {
    opt = max(opt, i + 2);
    while (opt < n - 1) {
      if (e[opt + 1] - e[i] <= u)
        opt++;
      else
        break;
    }
    if (e[opt] - e[i] <= u &&
        (long double)(e[opt] - e[i + 1]) / (e[opt] - e[i]) > ans)
      ans = (long double)(e[opt] - e[i + 1]) / (e[opt] - e[i]);
  }
  cout.precision(15);
  if (ans < 0)
    cout << -1;
  else
    cout << fixed << ans;
  return 0;
}
