#include <bits/stdc++.h>
using namespace std;
int const N = 100100;
int a[N];
int main() {
  int n, u;
  scanf("%d%d", &n, &u);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  sort(a, a + n);
  long long x = 0;
  long long y = 1;
  for (int i = 0; i < n - 2; ++i) {
    int k = upper_bound(a, a + n, a[i] + u) - a - 1;
    if (k <= i + 1) continue;
    if ((a[k] - a[i]) * x < (a[k] - a[i + 1]) * y) {
      x = a[k] - a[i + 1];
      y = a[k] - a[i];
    }
  }
  if (y == 1 && x == 0) {
    puts("-1");
  } else {
    printf("%.15f\n", (double)x / y);
  }
}
