#include <bits/stdc++.h>
using namespace std;
const double DINF = numeric_limits<double>::infinity();
const long long MOD = 1e9 + 7;
const double EPS = 1e-7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
mt19937 mmtw_(MOD);
uniform_int_distribution<long long> rd_;
long long randomll() { return rd_(mmtw_); }
long long rnd(long long x, long long y) { return rd_(mmtw_) % (y - x + 1) + x; }
template <class T>
T fact(T n) {
  if (n == 1) return 1;
  return n * fact(n - 1);
}
const int MAXN = 1e5 + 5;
long long u;
int n;
long double a[MAXN];
long double ans = -1;
int main() {
  cout.precision(20);
  cout.setf(ios::fixed);
  cin >> n >> u;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int r = 0;
  for (int i = 1; i < n - 1; ++i) {
    while (r < n - 1 && a[r + 1] - a[i - 1] <= u) {
      r++;
    }
    if (r <= i) continue;
    ans = max(ans, (a[r] - a[i]) / (a[r] - a[i - 1]));
  }
  if (ans < 0) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}
