#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long n, u;
int main() {
  scanf("%lld%lld", &n, &u);
  long long e[n], m[n], d[n];
  for (int i = 0; i < n; i++) cin >> e[i];
  int j = 0;
  for (int i = 0; i < n - 2; i++) {
    while (e[j] - e[i] <= u && j < n - 1) j++;
    if (j == n || e[j] - e[i] > u) j--;
    m[i] = e[j] - e[i];
    d[i] = e[i + 1] - e[i];
  }
  double mx = 0.0;
  bool f = false;
  for (int i = 0; i < n - 2; i++)
    if (e[i + 2] - e[i] <= u) {
      f = true;
      if (d[i] != m[i]) mx = max(mx, ((double)(m[i] - d[i])) / m[i]);
    }
  if (!f)
    printf("-1");
  else
    printf("%.17g", mx);
  return 0;
}
