#include <bits/stdc++.h>
using namespace std;
template <typename G>
struct triple {
  G first, S1, S2, T;
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, u;
  cin >> n >> u;
  vector<int> e(n);
  for (auto &i : e) cin >> i;
  bool found = false;
  long double ans = 0;
  for (int i = 1; i < n - 1; i++) {
    int p = (upper_bound(e.begin(), e.end(), u + e[i - 1]) - e.begin()) - 1;
    if (p > i) {
      found = true;
      ans = max(ans, (long double)(e[p] - e[i]) / (e[p] - e[i - 1]));
    }
  }
  cout << setprecision(10) << fixed;
  if (found)
    cout << ans << '\n';
  else
    cout << "-1\n";
  return 0;
}
