#include <bits/stdc++.h>
using namespace std;
int tab[100009];
int main() {
  int n, u;
  scanf("%d%d", &n, &u);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &tab[i]);
  }
  int mk = 2;
  int wyn1 = -1;
  int wyn2 = 1;
  tab[n] = 2000000009;
  for (int i = 0; i < n - 2; ++i) {
    while (tab[mk] - tab[i] <= u) ++mk;
    --mk;
    if (mk >= n)
      mk = n - 1;
    else if (mk - i < 2)
      mk = i + 2;
    if (tab[mk] - tab[i] <= u) {
      if (1LL * wyn1 * (tab[mk] - tab[i]) <
          1LL * wyn2 * (tab[mk] - tab[i + 1])) {
        wyn1 = tab[mk] - tab[i + 1];
        wyn2 = tab[mk] - tab[i];
      }
    }
  }
  long double wyn = wyn1;
  wyn /= wyn2;
  if (wyn1 == -1)
    printf("-1\n");
  else
    printf("%0.12Lf", wyn);
  return 0;
}
