#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, u;
  cin >> n >> u;
  int arr[n + 10];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int ck = 0;
  long double mx = 0;
  for (int i = 0; i < n; i++) {
    int pos = upper_bound(arr, arr + n, arr[i] + u) - arr;
    pos--;
    if (pos == i || pos == i + 1) continue;
    int ek = arr[pos];
    int ej = arr[i + 1];
    int ei = arr[i];
    long double ans1 = (ek - ej);
    long double ans2 = (ek - ei);
    long double ans = (long double)ans1 / ans2;
    mx = max(mx, ans);
    ck = 1;
  }
  if (ck == 0)
    cout << -1 << endl;
  else
    cout << fixed << setprecision(9) << mx << endl;
}
