#include <bits/stdc++.h>
const double Pi = 3.14159265;
const double e = 2.71828182;
const int N = 1e5 + 5;
const unsigned long long base = 163;
const long long INF = 0x3f3f3f3f;
using namespace std;
int a[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, u;
  cin >> n >> u;
  int flag = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i >= 2)
      if (a[i] - a[i - 2] <= u) flag = 1;
  }
  if (flag == 0) return cout << -1 << endl, 0;
  double ans = -1.0;
  for (int i = 0; i < n - 2; i++) {
    int l = upper_bound(a, a + n, a[i] + u) - a - 1;
    if (l - i < 2) continue;
    ans = max(ans, 1.0 * (a[l] - a[i + 1]) / (a[l] - a[i]));
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
