#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005];
int find(int x) {
  if (a[x + 2] - a[x] > m) return -1;
  int l = x + 2, r = n, tmp, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (a[mid] - a[x] <= m)
      tmp = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return tmp;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  double ans = -1.0;
  for (int i = 1; i < n - 1; i++) {
    int t = find(i);
    if (t == -1) continue;
    ans = max(ans, (double)(a[t] - a[i + 1]) / (double)(a[t] - a[i]));
  }
  if (ans < 0)
    printf("-1\n");
  else
    printf("%.10f\n", ans);
  return 0;
}
