#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int E[maxn];
int main() {
  int N, U;
  scanf("%d%d", &N, &U);
  for (int i = 0; i < N; i++) scanf("%d", &E[i]);
  int work = 0;
  double ans = -1;
  for (int i = 0; i < N - 1; i++) {
    int idx = upper_bound(E, E + N, E[i] + U) - E - 1;
    if (idx - i >= 2) {
      work = 1;
      int a = E[i + 1] - E[i];
      int b = E[idx] - E[i];
      double tmp = ((double)b - a) / b;
      ans = max(tmp, ans);
    }
  }
  if (work == 0) {
    printf("-1\n");
  } else {
    printf("%.10f\n", ans);
  }
  return 0;
}
