#include <bits/stdc++.h>
using namespace std;
int e[100010];
int main() {
  int n, u, i, j = 3;
  double ans = 0;
  scanf("%d%d", &n, &u);
  for (i = 1; i <= n; i++) scanf("%d", &e[i]);
  for (i = 1; i <= n; i++) {
    while (j <= n && e[j] - e[i] <= u) j++;
    j--;
    if (j > i + 1) ans = max(ans, (e[j] - e[i + 1] + 0.0) / (e[j] - e[i]));
  }
  if (ans == 0)
    cout << -1 << endl;
  else {
    cout.precision(19);
    cout << ans << endl;
  }
  return 0;
}
