#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, z, count = 0, temp = 0, h, w, x, y, u;
  float ans = -1;
  cin >> n >> u;
  vector<long long int> a;
  vector<long long int>::iterator k;
  for (i = 0; i < n; i++) {
    cin >> z;
    a.push_back(z);
  }
  for (i = 0; i < n - 1; i++) {
    k = upper_bound(a.begin(), a.end(), a[i] + u);
    k--;
    j = k - a.begin();
    j = j - i;
    if (j >= 2) {
      ans = max(ans, ((float)(*k - a[i + 1]) / (*k - a[i])));
    }
  }
  cout << fixed << setprecision(10) << ans;
}
