#include <bits/stdc++.h>
int in() {
  int r = 0, c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') return -in();
  for (; c > 32; r = (r << 1) + (r << 3) + c - '0', c = getchar())
    ;
  return r;
}
using namespace std;
const int INF = int(1e9 + 7);
long long v[100010];
int main() {
  long long n, u;
  double ans = -1;
  cin >> n >> u;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n - 2; i++) {
    long long a = v[i], b = v[i + 1];
    long long lo = i + 2, hi = n - 1, mid;
    double res = -1;
    while (lo <= hi) {
      mid = (lo + hi) / 2;
      if (v[mid] - a <= u) {
        res = (double)(v[mid] - b) / (double)(v[mid] - a);
        lo = mid + 1;
      } else
        hi = mid - 1;
    }
    ans = max(ans, res);
  }
  if (ans >= 0)
    cout << fixed << setprecision(10) << ans << endl;
  else
    cout << -1 << endl;
  return 0;
}
