#include <bits/stdc++.h>
using namespace std;
int in[100005];
long double Max(long double a, long double b) {
  if (a > b) return a;
  return b;
}
int main() {
  long double Ei, Ek, Ej, N = -1;
  int n, u, d, l, i, j, xd;
  scanf("%d %d", &n, &u);
  for (i = 0; i < n; ++i) scanf("%d", &in[i]);
  l = n - 2;
  for (i = n - 1; i > 1; --i) {
    Ek = in[i];
    d = in[i] - u;
    xd = lower_bound(in, in + n, d) - in;
    if ((in[xd] < d) || (i - xd < 2)) {
      l = i - 2;
      continue;
    }
    for (j = xd; j < l; ++j) {
      Ei = in[j];
      Ej = in[j + 1];
      N = Max(N, (Ek - Ej) / (Ek - Ei));
    }
    l = xd;
  }
  if (N == -1)
    cout << -1;
  else
    cout << setprecision(10) << fixed << N << endl;
}
