#include <bits/stdc++.h>
using namespace std;
int alln;
double u;
int main() {
  scanf("%d %lf", &alln, &u);
  vector<double> V;
  for (int i = 1; i <= alln; ++i) {
    double a;
    scanf("%lf", &a);
    V.push_back(a);
  }
  double ans = 0;
  bool flag = false;
  for (int i = 0; i < alln; ++i) {
    int idxk = upper_bound(V.begin(), V.end(), V[i] + u) - V.begin() - 1;
    if (idxk <= i + 1) continue;
    flag = true;
    ans = max(ans, (V[idxk] - V[i + 1]) / (V[idxk] - V[i]));
  }
  if (!flag)
    printf("-1\n");
  else
    printf("%.10f\n", ans);
  return 0;
}
