#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, u;
  cin >> n >> u;
  long long a[n + 1], i, j;
  set<long long> s;
  s.clear();
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    s.insert(a[i]);
  }
  double ans = -1.0;
  for (i = 1; i <= n - 2; ++i) {
    auto it = s.lower_bound(a[i] + u);
    if (*it <= a[n]) {
      if (*it - a[i] <= u && *it > a[i + 1]) {
        ans = max(
            ans, (double)(((double)(*it - a[i + 1])) / ((double)(*it - a[i]))));
      } else if (*it > a[i + 2]) {
        --it;
        if (*it - a[i] <= u)
          ans = max(ans, (double)(((double)(*it - a[i + 1])) /
                                  ((double)(*it - a[i]))));
      }
    } else {
      ans = max(
          ans, (double)(((double)(a[n] - a[i + 1])) / ((double)(a[n] - a[i]))));
    }
  }
  cout << fixed << setprecision(20) << (ans == 0 ? -1 : ans);
  return 0;
}
