#include <bits/stdc++.h>
using namespace std;
int n, u;
int a[100005], p[100005];
int main() {
  cin >> n >> u;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  double ans = -1;
  int pos = n - 2;
  p[n + 1] = n - 2;
  for (int i = n; i >= 1; i--) {
    p[i] = lower_bound(a + 1, a + n + 1, a[i] - u) - a;
    if (i == n) {
      for (int j = p[i]; j <= n - 2; j++)
        ans = max(ans, 1.0 * (a[i] - a[j + 1]) / (a[i] - a[j]));
      continue;
    }
    for (int j = p[i]; j < min(i - 1, p[i + 1]); j++) {
      ans = max(ans, 1.0 * (a[i] - a[j + 1]) / (a[i] - a[j]));
    }
  }
  printf("%.15f", ans);
  return 0;
}
