#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
long double a[100005];
int N, U;
int search(long double x) {
  int l = 0, r = N;
  int m = 0;
  while (l < r) {
    m = (l + r) / 2;
    if (x >= a[m]) {
      l = m + 1;
    } else
      r = m;
  }
  if (N == l) return N - 1;
  return l - 1;
}
int main() {
  scanf("%d%d", &N, &U);
  for (int i = 0; i < N; i++) cin >> a[i];
  long double maxx = -100;
  for (int i = 0; i < N - 2; i++) {
    int j = search(a[i] + U);
    if (j - i < 2) continue;
    maxx = max(maxx, (a[j] - a[i + 1] * 1.0) / (a[j] * 1.0 - a[i]));
  }
  if (maxx == -100)
    cout << -1 << endl;
  else
    printf("%.15Lf", maxx);
  return 0;
}
