#include <bits/stdc++.h>
using namespace std;
const long double PI = acosl(-1.0);
long long a[100005], n;
long long lesserelement(long long x) {
  long long l = 0, r = n - 1, mid;
  while (l < r) {
    mid = l + r + 1 >> 1;
    if (a[mid] > x)
      r = mid - 1;
    else
      l = mid;
  }
  if (a[r] <= x)
    return r;
  else
    return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long u;
  cin >> n >> u;
  for (long long ppp = 0; ppp < n; ppp++) cin >> a[ppp];
  long double ans = -1;
  for (long long i = 0; i < n - 2; i++) {
    long long k;
    k = lesserelement(a[i] + u);
    long long j = i + 1;
    if (j < k) ans = max(ans, (long double)(a[k] - a[j]) / (a[k] - a[i]));
  }
  if (ans == -1)
    cout << ans;
  else
    cout << fixed << setprecision(12) << ans;
  return 0;
}
