#include <bits/stdc++.h>
using namespace std;
bool sortbysec(pair<int, int> a, pair<int, int> b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second < b.second;
}
int main() {
  long long n, u, den, num, h, i, k;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> u;
  vector<long long> v;
  for (i = 0; i < n; i++) {
    cin >> k;
    v.push_back(k);
  }
  double ans = -1.0;
  for (i = 0; i < n - 2; i++) {
    h = lower_bound(v.begin(), v.end(), v[i] + u) - v.begin();
    if (h == n) {
      h--;
    }
    if (v[h] - v[i] > u) {
      h--;
    }
    if (h - i >= 2) {
      num = v[h] - v[i + 1];
      den = v[h] - v[i];
      ans = max(ans, num / (den * 1.0));
    }
  }
  if (ans == -1.0)
    cout << -1 << "\n";
  else
    cout << fixed << setprecision(20) << ans << "\n";
}
