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