#include <bits/stdc++.h>
using namespace std;
const long double PI = acosl(-1);
vector<int> numbers;
int binarysearch(int value, int l, int r) {
  if (l == r) return l;
  int mid = (l + r + 1) / 2;
  if (numbers[mid] <= value) return binarysearch(value, mid, r);
  return binarysearch(value, l, mid - 1);
}
int main() {
  int n, U;
  long double eff = 0;
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  cin >> n >> U;
  for (int i = 0; i < (n); ++i) {
    int tmp;
    cin >> tmp;
    numbers.push_back(tmp);
  }
  for (int i = 0; i < (n - 2); ++i) {
    int tmp = numbers[binarysearch(numbers[i] + U, 0, n - 1)];
    if (tmp == numbers[i] || tmp == numbers[i + 1]) continue;
    eff = max(eff, ((long double)(tmp - numbers[i + 1])) / (tmp - numbers[i]));
  }
  if (eff == 0)
    cout << "-1\n";
  else {
    cout << fixed << setprecision(12) << eff << endl;
  }
}
