#include <bits/stdc++.h>
using namespace std;
long double ans = -1, temp, temp2, temp3;
vector<long long int> v;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int n, m, i, j, k, a, b, c;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
  }
  j = n - 1;
  for (i = n - 3; i >= 0; i--) {
    while (v[j] - v[i] > m) j--;
    if (j - i < 2) continue;
    temp = v[i];
    temp2 = v[i + 1];
    temp3 = v[j];
    ans = max(ans, (temp3 - temp2) / (temp3 - temp));
  }
  cout << fixed << setprecision(9) << ans;
}
