#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  long long t;
  t = 1;
  while (t--) solve();
  return 0;
}
long long n, u, e[100005];
void solve() {
  cin >> n >> u;
  for (long long i = 1; i <= n; ++i) cin >> e[i];
  long double ans = 0.0;
  long long uk = 3;
  for (long long i = 1; i <= n - 2; ++i) {
    uk = max(i + 2, uk);
    while ((uk < n) && (e[uk + 1] - e[i] <= u)) ++uk;
    if (e[uk] - e[i] > u) continue;
    ans = max(
        ans, ((long double)(e[uk] - e[i + 1])) / ((long double)(e[uk] - e[i])));
  }
  if (ans < 0.0000000000000001)
    cout << -1 << '\n';
  else
    cout << fixed << setprecision(10) << ans << '\n';
}
