#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  long long n, U;
  cin >> n >> U;
  vector<long long> a(n, 0);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long double ans = 0.0;
  long long flag = 0;
  for (long long i = 0; i < n - 2; i++) {
    long long Ei, Ej, Ek;
    Ei = a[i];
    Ej = a[i + 1];
    long long req = Ei + U;
    long long left = 0;
    long long right = n - 1;
    long long mid = (left + right) / 2;
    if (a[right] <= req) {
      Ek = a[right];
    } else {
      while (left < right) {
        if (a[mid] == req) break;
        if (a[mid] > req)
          right = mid - 1;
        else if (a[mid] < req)
          left = mid + 1;
        mid = (left + right) / 2;
      }
      if (a[mid] != req) {
        long long count = 2;
        while (count--) {
          if (mid + 1 < n) mid++;
        }
        while (a[mid] > req) mid--;
      }
      Ek = a[mid];
    }
    if (Ek <= Ej) continue;
    flag = 1;
    ans = max(ans, (long double)((long double)Ek - (long double)Ej) /
                       (long double)((long double)Ek - (long double)Ei));
  }
  cout << fixed << setprecision(10);
  if (flag == 0) {
    cout << -1 << '\n';
    return 0;
  } else
    cout << ans << '\n';
}
