#include <bits/stdc++.h>
using namespace std;
int const N = 1e6 + 4, NN = 2e5 + 3, inf = 1e9 + 7;
long long const md = 998244353;
long long a[N], b[N], n, l, r, k, m, x, bbp, kk, sz, ans;
long long dp[N], q, qq;
char ch;
bool us[N];
map<string, long long> mp;
string second, ss, t;
vector<pair<long long, long long> > ot;
vector<long long> v;
pair<long long, long long> p[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  l = 1;
  double d = 0;
  for (int i = 1; i < n; i++) {
    while (a[l + 1] - a[i] <= x && l < n) {
      l++;
    }
    if (l - i < 2) continue;
    d = max(d, (double)(a[l] - a[i + 1]) / (a[l] - a[i]));
  }
  if (d == 0)
    cout << -1;
  else
    cout << fixed << setprecision(13) << d;
  return 0;
}
