#include <bits/stdc++.h>
using namespace std;
void init_ios() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
const long long N = (long long)1e5 + 10;
long long n, u, a[N];
long double calc(long long i, long long j, long long l) {
  long double p = (long double)a[l] - a[j];
  long double q = (long double)a[l] - a[i];
  return p / q;
}
signed main() {
  init_ios();
  cin >> n >> u;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  long long j = 2;
  long double res = -1;
  for (long long i = 1; i + 2 <= n; ++i) {
    while (j <= n && a[j] - a[i] <= u) ++j;
    --j;
    if (j - i < 2) continue;
    res = max(res, calc(i, i + 1, j));
  }
  cout << fixed << setprecision(12) << res << "\n";
}
