#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, sum = 0, cnt = 0, k, l, flag = 0;
  double ans = -1;
  cin >> n >> m;
  double a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 2; i++) {
    long long x = upper_bound(a + i, a + n, a[i] + m) - a;
    if (x >= n || (a[x] - a[i]) > m) x--;
    if (x - i >= 2) {
      double q = (a[x] - a[i + 1]) / (a[x] - a[i]);
      ans = max(ans, q);
    }
  }
  if (ans == -1)
    cout << -1;
  else
    cout << fixed << setprecision(10) << ans;
  return 0;
}
