#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int e[N];
void solve() {
  int n, u;
  scanf("%d%d", &n, &u);
  long double best = -1;
  for (int i = 0; i < n; i++) scanf("%d", &e[i]);
  int k = 0;
  for (int i = 0; i < n; i++) {
    while (k + 1 < n && e[k + 1] - e[i] <= u) k++;
    int j = i + 1;
    if (i + 2 <= k) {
      long double up = e[k] - e[j];
      long double down = e[k] - e[i];
      long double cur = up / down;
      best = max(best, cur);
    }
  }
  if (best == -1)
    printf("-1");
  else
    printf("%.15lf\n", (double)best);
}
int main() {
  solve();
  (void)0;
  return 0;
}
