#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (!a) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
const long long MOD = 1e9 + 7;
const long long mod = 1e9 + 7;
void sout() { cout << "\n"; }
template <typename T, typename... Types>
void sout(T var1, Types... var2) {
  cout << var1 << " ";
  sout(var2...);
}
template <typename T>
void sout(vector<T> arr) {
  for (auto it : arr) {
    cout << it << " ";
  }
  sout();
}
long long n, m;
long long temp;
long long cnt;
long long ans;
long long ind;
long long i, j;
long long a, b;
vector<long long> arr;
vector<pair<long long, long long> > brr;
long long k;
void test_case() {
  long long n, k;
  cin >> n >> k;
  arr.resize(n);
  for (auto &it : arr) {
    cin >> it;
  }
  double ans = -1;
  for (long long i = 0; i < n - 2; i++) {
    long long allowed = arr[i] + k;
    auto it = upper_bound(arr.begin(), arr.end(), allowed);
    it--;
    long long ind = it - arr.begin();
    if (ind < i + 2) {
      continue;
    } else {
      double a = arr[ind] - arr[i + 1];
      double b = arr[ind] - arr[i];
      ans = max(ans, a / b);
    }
  }
  cout << ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long t = 1;
  while (t--) {
    test_case();
  }
  cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}
