#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, d;
  cin >> n >> d;
  int e[n];
  for (int i = 0; i < n; i++) {
    cin >> e[i];
  }
  double ans = 0.0;
  for (int i = 0; i < n; i++) {
    int l = 0, h = n - 1;
    int p = -1;
    while (l < h) {
      int mid = (l + h) / 2;
      if (mid == p) {
        mid = (l + h + 1) / 2;
      }
      p = mid;
      if (e[mid] - e[i] <= d) {
        l = mid;
      } else {
        h = mid - 1;
      }
    }
    if (l - i >= 2) {
      ans = max(ans, (e[l] - e[i + 1] * 1.0) / (e[l] - e[i]));
    }
  }
  cout << fixed << setprecision(9) << (ans == 0.0 ? -1 : ans);
  return 0;
}
