#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int MAXN = 3e5 + 5;
const long long MOD = 1e9 + 7;
int e[MAXN];
int main() {
  int n, u;
  scanf("%d%d", &n, &u);
  for (int i = (1); i <= (n); i++) {
    scanf("%d", &e[i]);
  }
  double ans = -1.0;
  for (int i = (1); i <= (n - 2); i++) {
    int l = i + 2, r = n;
    while (l <= r) {
      int mid = (l + r) >> 1;
      if (e[mid] - e[i] <= u)
        l = mid + 1;
      else
        r = mid - 1;
    }
    double p = 1.0 * (e[r] - e[i + 1]) / (e[r] - e[i]);
    ans = max(ans, p);
  }
  if (ans > 0)
    printf("%.9f\n", ans);
  else
    printf("-1\n");
  return 0;
}
