#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const int mod = 1e9 + 7;
const int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};
const int maxn = 1e5 + 11;
long long n, k;
double ans, a[maxn];
double f(int i, int k) { return ((a[k] - a[i + 1]) / (a[k] - a[i])); }
double get(int x) {
  int r = min(upper_bound(a + 1, a + n + 1, a[x] + k) - a - 1ll, n);
  return f(x, r);
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i + 2 <= n; ++i) {
    ans = max(ans, get(i));
  }
  cout.precision(10);
  if (ans == 0)
    cout << -1;
  else
    cout << fixed << ans;
  return 0;
}
