#include <bits/stdc++.h>
using namespace std;
long long n, u;
signed main() {
  cin >> n >> u;
  vector<long long> e(n);
  for (long long i = 0; i < n; i++) {
    cin >> e[i];
  }
  long long i = 0;
  while (i + 2 < n && e[i + 2] - e[i] > u) {
    i++;
  }
  if (i + 2 == n) {
    cout << -1 << endl;
    return 0;
  }
  long long k = i + 2;
  long long bx = e[i + 2] - e[i + 1], by = e[i + 2] - e[i];
  for (long long j = i; j < n; j++) {
    while (k + 1 < n && e[k + 1] - e[j] <= u) {
      k++;
    }
    if (k - j > 1) {
      long long tbx = e[k] - e[j + 1];
      long long tby = e[k] - e[j];
      if (tbx * by > bx * tby) {
        bx = tbx;
        by = tby;
      }
    }
  }
  cout << fixed;
  cout.precision(20);
  cout << ((double)bx) / ((double)by) << endl;
  return 0;
}
