#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
double a[N];
int n, U;
int div_find(int i) {
  int l = i + 2, r = n - 1, mid, ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (a[mid] - a[i] > U)
      r = mid - 1;
    else
      l = mid + 1, ans = mid;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  double ans = -1;
  cin >> n >> U;
  for (int i = 0; i < n; i++) cin >> a[i];
  int res;
  for (int i = 0; i < n - 2; i++) {
    res = div_find(i);
    if (res != -1) ans = max(ans, (a[res] - a[i + 1]) / (a[res] - a[i]));
  }
  if (ans < 0)
    cout << "-1" << endl;
  else
    cout << ans << endl;
  return 0;
}
