#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  long long u;
  vector<long long> v;
  cin >> n >> u;
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  long double ans = -1;
  int back = 0;
  for (int i = 0; i < n - 1; ++i) {
    long long x = v[i + 1] - v[i];
    while (back + 1 < n && v[back + 1] - v[i] <= u) {
      ++back;
    }
    if (back <= i + 1) {
      continue;
    }
    long long y = v[back] - v[i];
    ans = std::max(static_cast<long double>(y - x) / y, ans);
  }
  if (ans < -0.5) {
    cout << "-1" << endl;
    return 0;
  }
  cout << setprecision(20) << ans << endl;
  return 0;
}
