#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, U, E[100100];
  cin >> n >> U;
  for (int i = 0; i < n; i++) cin >> E[i];
  double ans = -1;
  for (int i = 0; i + 2 < n; i++) {
    int x = upper_bound(E, E + n, E[i] + U) - E;
    x--;
    if (x < i + 2) continue;
    ans = max(ans, (E[x] - E[i + 1]) / (double)(E[x] - E[i]));
  }
  printf("%.10f", ans);
  return 0;
}
