#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int n, U, a[MAXN];
double ans = 0;
int main() {
  cin >> n >> U;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int now = 1;
  for (int i = 1; i <= n; i++) {
    while (now <= n && a[now] - a[i] <= U) now++;
    now--;
    if (now - i + 1 < 3) continue;
    ans = max(ans, (a[now] - a[i + 1]) * 1.0 / (a[now] - a[i]));
  }
  if (ans == 0)
    cout << -1 << endl;
  else
    printf("%.10lf\n", ans);
  return 0;
}
