#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int n, u;
  cin >> n >> u;
  vector<long long int> a;
  long long int y;
  cin >> y;
  a.push_back(y);
  long long int b[n];
  for (long long int i = 1; i < n; i++) {
    long long int x;
    cin >> x;
    a.push_back(x);
    b[i - 1] = a[i] - a[i - 1];
  }
  b[n] = -1;
  long double r = -1;
  for (long long int i = 0; i < n - 2; i++) {
    vector<long long int>::iterator it;
    it = lower_bound(a.begin(), a.end(), a[i] + u);
    if (it == a.end()) {
      it--;
    }
    if (*it > a[i] + u) {
      it--;
    }
    if (it - a.begin() <= i + 1) {
      continue;
    }
    long double x = (*it - a[i + 1]) * 1.0 / (*it - a[i]);
    if (r < x) {
      r = x;
    }
  }
  if (r == -1) {
    cout << -1;
    return 0;
  }
  cout << fixed << setprecision(10) << r;
  return 0;
}
