#include <bits/stdc++.h>
using namespace std;
const int64_t INF = 1e9, MOD = 1e9 + 7, MAXN = 1e5 + 7, MAX = 5;
const long double EPS = 1e-9, PI = acos(-1);
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t n, u;
  cin >> n >> u;
  vector<int64_t> nums(n);
  for (int64_t i = 0; i < n; ++i) cin >> nums[i];
  long double ans = -1.0;
  for (int64_t i = 0; i < n - 1; ++i) {
    long double a = nums[i], b = nums[i + 1];
    int64_t left = i + 1, right = n;
    while (right - left > 1) {
      int64_t middle = (left + right) / 2;
      if (nums[middle] - nums[i] <= u)
        left = middle;
      else
        right = middle;
    }
    if (left == i + 1) continue;
    long double x = nums[left];
    long double may_ans = (x - b) / (x - a);
    if (ans + EPS < may_ans) ans = may_ans;
  }
  cout << fixed;
  cout.precision(10);
  if (ans < 0)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
