#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  ;
  long long n, u, k, pos, an = -1, j, f = 0;
  cin >> n >> u;
  long long a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  long double ans, ans2, ans3, ans4 = -1;
  for (int i = 0; i < n; ++i) {
    long long lo = lower_bound(a, a + n, a[i] + u) - a;
    if (a[lo] != a[i] + u) lo--;
    long long j = i + 1;
    long long k = lo;
    if (j != k && (a[lo] - a[i]) != 0) {
      f = 1;
      ans = a[k] - a[j];
      ans2 = a[k] - a[i];
      ans3 = ans / ans2;
      ans4 = max(ans4, ans3);
    }
  }
  if (f == 0)
    cout << "-1" << endl;
  else
    cout << setprecision(16) << ans4 << endl;
}
