#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000007LL;
const double EPS = 1e-14;
const long long inf_ll = (long long)1e18;
const long long maxn = 100005LL;
const long long mod = 1000000007LL;
int n, U;
int a[maxn];
int main() {
  scanf("%d%d", &n, &U);
  for (register int(i) = (1); (i) <= (n); ++i) scanf("%d", a + i);
  double ans = -1.0;
  for (register int(i) = (1); (i) <= (n); ++i) {
    int j = upper_bound(a + 1, a + n + 1, a[i] + U) - a - 1;
    if (j - i < 2) continue;
    ans = ((ans) > (((double)a[j] - a[i + 1]) / (a[j] - a[i]))
               ? (ans)
               : (((double)a[j] - a[i + 1]) / (a[j] - a[i])));
  }
  if (ans < 0)
    puts("-1");
  else
    printf("%.12lf\n", ans);
  return 0;
}
