#include <bits/stdc++.h>
using namespace std;
int main() {
  long long number, n, u, i, e, index;
  cin >> n >> u;
  vector<long long> v;
  double maxi = -1.00, a, b;
  bool check = true;
  for (i = 0; i < n; i++) {
    cin >> e;
    v.push_back(e);
  }
  for (i = 0; i < n; i++) {
    e = v[i] + u;
    index = lower_bound(v.begin(), v.end(), e) - v.begin();
    if (index >= n || v[index] - v[i] > u) index--;
    number = index - i - 1;
    if (number > 0) {
      a = (double)v[index] - v[i + 1];
      b = (double)v[index] - v[i];
      maxi = max(a / b, maxi);
      check = false;
    }
  }
  if (check)
    cout << "-1" << endl;
  else
    printf("%.30lf\n", maxi);
}
