#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const int inf = 1e9 + 7;
int a[100005];
int main() {
  int n, u;
  scanf("%d%d", &n, &u);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  double ans = -1;
  int r = 0;
  for (int i = 0; i + 2 < n; i++) {
    while (r < n && a[r] - a[i] <= u) r++;
    if (r - i > 2)
      ans = max(ans, 1.0 * (a[r - 1] - a[i + 1]) / (a[r - 1] - a[i]));
  }
  printf("%.9f\n", ans);
  return 0;
}
