#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
const long long MOD = 1e9 + 7;
int n, u, e[N];
int main() {
  scanf("%d%d", &n, &u);
  for (int i = 0; i < n; i++) scanf("%d", e + i);
  double ans = 0.0;
  bool ok = 0;
  for (int i = 0; i < n; i++) {
    int l = i + 2, r = n - 1, m, x = -1;
    while (l <= r) {
      m = (l + r) / 2;
      if (e[m] - e[i] <= u) {
        x = m;
        l = m + 1;
      } else
        r = m - 1;
    }
    if (x != -1) {
      ok = 1;
      ans = max(ans, 1.0 * (double(e[x] - e[i + 1])) / double(e[x] - e[i]));
    }
  }
  if (!ok) {
    puts("-1");
    return 0;
  }
  printf("%.11lf\n", ans);
  return 0;
}
