#include <bits/stdc++.h>
using namespace std;
const long long N = 100005;
long long a[N];
int main() {
  long long n, i, u, k;
  double ans;
  cin >> n >> u;
  for (i = 0; i < n; i++) cin >> a[i];
  ans = -1;
  for (i = 0; i < n - 2; i++) {
    if (a[i + 2] - a[i] > u) continue;
    k = upper_bound(a + i, a + n, a[i] + u) - a - 1;
    ans = max(ans, (double)(a[k] - a[i + 1]) / (double)(a[k] - a[i]));
  }
  printf("%.15lf\n", ans);
  return 0;
}
