#include <bits/stdc++.h>
using namespace std;
int a[100010];
int main() {
  int n, U;
  cin >> n >> U;
  for (int i = (0); i < (n); ++i) cin >> a[i];
  int i = 0, j = 0;
  double maxi = -1;
  while (i < n) {
    while (j < n - 1 && a[j] - a[i] <= U) ++j;
    if (a[j] - a[i] > U) j--;
    if (j - i <= 1) {
      ++i;
      continue;
    }
    maxi = max(maxi, (double)(a[j] - a[i + 1]) / (double)(a[j] - a[i]));
    ++i;
  }
  printf("%0.9f\n", maxi);
  return 0;
}
