#include <bits/stdc++.h>
using namespace std;
int const N = 1000020;
int a[100005];
int n, u;
int main() {
  scanf("%d%d", &n, &u);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  double ans = 0;
  bool ans1 = 0;
  for (int i = 0; i < n - 2; i++) {
    int *x = upper_bound(a, a + n, a[i] + u);
    x--;
    if (*x == a[i] || *x == a[i + 1]) continue;
    ans = max(ans, (double)(*x - a[i + 1]) / (*x - a[i]));
    ans1 = 1;
  }
  if (ans1) {
    printf("%.10lf", ans);
  } else {
    puts("-1");
  }
  return 0;
}
