#include <bits/stdc++.h>
using namespace std;
int n;
long long u, e[100010];
int main() {
  scanf("%d %lld", &n, &u);
  for (int i = 1; i < (n + 1); i++) scanf("%lld", &e[i]);
  double maxx = -1;
  int k = 2;
  for (int i = 1; i <= n - 2; i++) {
    if (i == k) k = i + 1;
    while (k + 1 <= n && e[k + 1] - e[i] <= u) k++;
    if (k <= n && e[k] - e[i] <= u && i + 1 < k) {
      double res = 1.0 * (e[k] - e[i + 1]) / (double)(e[k] - e[i]);
      maxx = max(res, maxx);
    }
  }
  printf("%.12f\n", maxx);
}
