#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, u;
  cin >> n >> u;
  vector<long long int> a(n);
  long long int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  float ans = -1;
  for (i = 0; i < n; i++) {
    long long int l = i + 1, r = n - 1, mid;
    while (l <= r) {
      mid = (l + r + 1) / 2;
      if (l == r) {
        break;
      }
      if (a[mid] - a[i] <= u) {
        if (mid > i) {
          float temp = (float)(a[mid] - a[i + 1]) / (float)(a[mid] - a[i]);
          ans = max(ans, temp);
        }
        l = mid;
      } else {
        r = mid - 1;
      }
    }
  }
  printf("%.9f\n", ans);
  return 0;
}
