#include <bits/stdc++.h>
using namespace std;
int a[100009];
int main() {
  int i, j, t1, t2, t3, t4, n, u;
  double ans, buf1, buf2, buf3, buf4, temper;
  bool flag = false;
  scanf("%d %d", &n, &u);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  ans = -1;
  for (i = 0; i < n - 2; i++) {
    t1 = upper_bound(a, a + n, a[i] + u) - a;
    t1--;
    if (t1 == i || t1 == i + 1) {
      continue;
    }
    flag = true;
    buf1 = (1.0 * (a[t1] - a[i + 1])) / (a[t1] - a[i]);
    ans = max(ans, buf1);
  }
  if (!flag) {
    printf("-1\n");
    return 0;
  }
  printf("%.10lf\n", ans);
  return 0;
}
