#include <bits/stdc++.h>
using namespace std;
int flag = 0;
int a[100005];
double ans;
int main() {
  int n, u;
  cin >> n >> u;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 2; i++) {
    int pos = lower_bound(a, a + n, a[i] + u) - a;
    if (a[pos] > a[i] + u || pos >= n) {
      pos--;
    }
    if (a[pos] == a[i] || a[pos] == a[i + 1]) continue;
    flag = 1;
    ans = max(ans, 1.0 * (a[pos] - a[i + 1]) / (a[pos] - a[i]));
  }
  if (flag)
    printf("%.10f\n", ans);
  else
    cout << -1 << endl;
  return 0;
}
