#include <bits/stdc++.h>
using namespace std;
int main() {
  cout.precision(15);
  long long int n, u;
  cin >> n >> u;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long double ans = 0;
  bool valid = false;
  for (int i = 0; i < n - 2; i++) {
    int l = i + 2, r = n - 1;
    bool check = false;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (arr[mid] - arr[i] > u)
        r = mid - 1;
      else {
        l = mid + 1;
        valid = true;
        check = true;
      }
    }
    if (check == true) {
      ans = max(ans, (long double)(arr[l - 1] - arr[i + 1]) /
                         (long double)(arr[l - 1] - arr[i]));
    }
  }
  if (valid == true)
    cout << ans;
  else
    cout << -1 << endl;
  return 0;
}
