#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const int HASH = MAXN;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int a[MAXN];
int main() {
  int n, u;
  scanf("%d %d", &n, &u);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  double ans = -1;
  int i = 0, k = 2;
  while (k < n) {
    while (a[k + 1] - a[i] <= u && k + 1 < n) {
      k++;
    }
    if (a[k] - a[i] <= u) {
      ans = max(ans, 1.0 * (a[k] - a[i + 1]) / (a[k] - a[i]));
      i++;
      if (k < i + 2) k++;
    } else {
      if (k = i + 2) {
        i++;
        k++;
      } else {
        i++;
      }
    }
  }
  printf("%.10lf\n", ans);
  return 0;
}
