#include <bits/stdc++.h>
using namespace std;
int E[100010];
int main() {
  int n, U;
  scanf("%d%d", &n, &U);
  for (int i = 1; i <= n; i++) scanf("%d", E + i);
  double ans = -1.0;
  for (int i = 1; i <= n; i++) {
    int pos = upper_bound(E + 1, E + 1 + n, E[i] + U) - E - 1;
    if (pos >= i + 2) {
      ans = max(ans, (double)(E[pos] - E[i + 1]) / (E[pos] - E[i]));
    }
  }
  if (ans < 0)
    puts("-1");
  else
    printf("%.15lf\n", ans);
  return 0;
}
