#include <bits/stdc++.h>
using namespace std;
int main() {
  size_t n;
  int u;
  cin >> n >> u;
  int a[n];
  for (size_t i = 0; i != n; ++i) {
    cin >> a[i];
  }
  size_t now = 0;
  long double ans = 0;
  for (size_t i = 0; i != n - 2; ++i) {
    now = max(now, i);
    while ((now != n - 1) && (a[now + 1] - a[i] <= u)) {
      ++now;
    }
    if (now - i >= 2) {
      ans = max(ans, (long double)(a[now] - a[i + 1]) / (a[now] - a[i]));
    }
  }
  if (ans == 0) {
    cout << -1 << endl;
  } else {
    cout.precision(21);
    cout << ans << endl;
  }
  return 0;
}
