#include <bits/stdc++.h>
template <typename X>
inline X abs(const X& a) {
  return a < 0 ? -a : a;
}
template <typename X>
inline X sqr(const X& a) {
  return a * a;
}
using namespace std;
const int INF = 1000 * 1000 * 1000;
const long double EPS = 1e-9;
const long double PI = acos(-1.0);
const int N = 100 * 1000 + 13;
int n, u;
int a[N];
int idx1 = -1, idx2, idx3;
inline void read() {
  scanf("%d%d", &n, &u);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
}
inline void solve() {
  int k = 0;
  for (int i = 0; i < n; i++) {
    k = max(k, i);
    while (k + 1 < n && a[k + 1] - a[i] <= u) {
      k++;
    }
    if (k - i - 1 <= 0) {
      continue;
    }
    int j = i + 1;
    if (idx1 == -1 || (a[k] - a[j]) * 1ll * (a[idx3] - a[idx1]) >
                          (a[idx3] - a[idx2]) * 1ll * (a[k] - a[i])) {
      idx1 = i, idx2 = j, idx3 = k;
    }
  }
  if (idx1 == -1) {
    cout << -1 << endl;
    return;
  }
  cout.precision(20);
  cout << (double)(a[idx3] - a[idx2]) / (a[idx3] - a[idx1]) << endl;
}
int main() {
  srand(time(NULL));
  cerr << setprecision(10) << fixed;
  read();
  solve();
}
