#include <bits/stdc++.h>
using namespace std;
long long a[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  long long U;
  cin >> n >> U;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int uk = 1, lt = 1;
  bool fl = false;
  long double ans = 0;
  while (uk <= n) {
    lt = max(lt, uk);
    while (lt < n && a[lt + 1] - a[uk] <= U) lt++;
    if (lt - uk >= 2) {
      fl = true;
      long double t = 1.0 * (a[lt] - a[uk + 1]) / (a[lt] - a[uk]);
      ans = max(ans, t);
    }
    uk++;
  }
  if (!fl) cout << -1, exit(0);
  cout.precision(10);
  cout << fixed << ans;
  return 0;
}
