#include <bits/stdc++.h>
using namespace std;
ofstream fo("test.out");
ifstream fi("test.inp");
int n, u, a[100005];
double rs = -1;
int BS(int l, int r) {
  int mid, t = l - 2, pos = -1;
  while (l <= r) {
    mid = (l + r + 1) >> 1;
    if (a[mid] - a[t] > u)
      r = mid - 1;
    else {
      pos = mid;
      l = mid + 1;
    }
  }
  return pos;
}
int main() {
  cin >> n >> u;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i + 2 <= n; ++i) {
    int pos = BS(i + 2, n);
    if (pos != -1) rs = max(rs, (a[pos] - a[i + 1]) / double(a[pos] - a[i]));
  }
  if (rs == -1)
    cout << -1;
  else
    printf("%.10f", rs);
  return 0;
}
