#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, u, i, t;
  cin >> n >> u;
  double f = 0.0, g = 1;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    t = upper_bound(a, a + n, a[i] + u) - a;
    t--;
    if (t != i && i + 1 != t)
      f = max(f, ((a[t] - a[i + 1]) * g) / ((a[t] - a[i]) * g));
  }
  if (f == 0)
    cout << -1;
  else
    printf("%.9lf", f);
  return 0;
}
