#include <bits/stdc++.h>
using namespace std;
struct IntCmp {
  bool operator()(const std::pair<std::string, int> &lhs,
                  const std::pair<std::string, int> &rhs) {
    return lhs.second > rhs.second;
  }
};
long long pow2(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % 1000000007;
    y >>= 1;
    x = x * x % 1000000007;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, u, i = 0, j = 0;
  double maxi = -1;
  cin >> n >> u;
  long long e[100005];
  for (long long int i = 0; i < n; i++) cin >> e[i];
  while (i < n) {
    while (j < n - 1 && ((e[j] - e[i]) <= u)) {
      j++;
      if (e[j] - e[i] > u) {
        j--;
        break;
      }
    }
    if (j != i && j != (i + 1))
      maxi = (max(maxi, (double)(e[j] - e[i + 1]) / (double)(e[j] - e[i])));
    i++;
  }
  if (maxi > 0)
    cout << fixed << setprecision(20), cout << maxi;
  else
    cout << "-1";
  return 0;
}
