#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long binaryU(long long vec[], long long n, long long item, int i) {
  long long lower = i, high = n - 1;
  long long ans = i;
  while (lower <= high) {
    long long mid = (lower + high) / 2;
    if (vec[mid] == item) {
      return mid;
    } else if (vec[mid] < item) {
      lower = mid + 1;
      ans = mid;
    } else {
      high = mid - 1;
    }
  }
  return ans;
}
int main() {
  long long n, u;
  scanf("%lld", &n), scanf("%lld", &u);
  long long vec[n];
  long long x;
  int count = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &x);
    vec[i] = x;
  }
  if (count == n - 1) {
    cout << -1;
    return 0;
  }
  double ans = -1.00000;
  for (int i = 0; i < n; i++) {
    int upper = binaryU(vec, n, vec[i] + u, i);
    int lower = i + 1;
    if (i < lower && lower < upper) {
      ans = max(ans, (vec[upper] - vec[lower]) * 1.000000000000 /
                         (vec[upper] - vec[i]));
    }
  }
  cout << setprecision(10);
  cout << ans;
  return 0;
}
