#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int mod = 1e9 + 6;
const int MOD = 1e9 + 7;
long long n, u;
long long a[N];
int main() {
  scanf("%lld", &n);
  scanf("%lld", &u);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  bool flag = false;
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    int pos = upper_bound(a + 1, a + n + 1, a[i] + u) - a;
    pos--;
    if (pos - i < 2) continue;
    flag = true;
    ans = max(ans, (1.0 * (a[pos] - a[i + 1]) / (a[pos] - a[i])));
  }
  if (flag)
    printf("%.12f\n", ans);
  else
    puts("-1");
  return 0;
}
