#include <bits/stdc++.h>
using namespace std;
queue<int> x;
int a[100100];
int main() {
  int n, u, i;
  double ans = -1, z;
  scanf("%d%d", &n, &u);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  x.push(a[n - 1]);
  x.push(a[n - 2]);
  for (i = n - 3; i >= 0; i--) {
    while (!x.empty() && x.front() > a[i] + u) x.pop();
    if (x.size() > 1) {
      z = (double)(x.front() - a[i + 1]) / (double)(x.front() - a[i]);
      if (ans < z) ans = z;
    }
    x.push(a[i]);
  }
  if (ans < 0)
    printf("-1");
  else
    printf("%.9lf", ans);
  return 0;
}
