#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
  return out << "(" << a.first << "," << a.second << ")";
}
template <class A>
ostream& operator<<(ostream& out, const vector<A>& a) {
  out << "";
  for (auto it = a.begin(); it != a.end(); it++) {
    if (it != a.begin()) out << " ";
    out << *it;
  }
  out << "";
  return out;
}
template <class A, class B>
istream& operator>>(istream& in, pair<A, B>& a) {
  in >> a.first >> a.second;
  return in;
}
template <class A>
istream& operator>>(istream& in, vector<A>& a) {
  for (A& i : a) in >> i;
  return in;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long double n, u;
  cin >> n >> u;
  vector<long long> v(n);
  cin >> v;
  long double ans = -1.0;
  for (long long i = 0; i <= n - 3; i++) {
    long long k = lower_bound(v.begin() + i + 1, v.end(), v[i] + u) - v.begin();
    if (k == n) k--;
    while (k - i + 1 > 3 && v[k] - v[i] > u) k--;
    if (k - i + 1 >= 3 && v[k] - v[i] <= u) {
      long double eta = (long double)(v[k] - v[i + 1]) / (v[k] - v[i]);
      ans = max(ans, eta);
    }
  }
  cout << fixed << setprecision(10) << ans;
}
