#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10034217728")
using namespace std;
int main() {
  int n;
  long long u;
  cin >> n >> u;
  vector<long long> e(n);
  for (int i = 0; i < n; i++) cin >> e[i];
  int r = 1;
  double ans = -1e9;
  for (int i = 0; i < n; i++) {
    while (r < e.size() && e[r] - e[i] <= u) r++;
    int j = i + 1;
    int k = r - 1;
    if (j >= r) continue;
    if (!(i < j && j < k)) continue;
    ans = max(ans, (e[k] - e[j] + 0.) / (e[k] - e[i] + 0.));
  }
  if (ans < 0) {
    cout << -1;
    return 0;
  }
  printf("%.12lf", ans);
  return 0;
}
