#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, e;
  cin >> n >> e;
  vector<long long> mas;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    mas.push_back(x);
  }
  double currentAnswer = 0;
  bool smthFound = false;
  for (int i = 0; i <= n - 3; ++i) {
    int index =
        upper_bound(mas.cbegin(), mas.cend(), mas[i] + e) - mas.cbegin();
    index--;
    if (index > i + 1) {
      smthFound = true;
      double current =
          ((double)(mas[index] - mas[i + 1])) / ((double)(mas[index] - mas[i]));
      if (current > currentAnswer) currentAnswer = current;
    }
  }
  if (smthFound)
    cout << fixed << setprecision(10) << currentAnswer;
  else
    cout << -1;
}
