#include <bits/stdc++.h>
int dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};
using namespace std;
long long power(long long a, long long p, long long M) {
  long long r = 1;
  a = a % M;
  while (p > 0) {
    if (p % 2) r = (r * a) % M;
    a = (a * a) % M;
    p /= 2;
  }
  return r;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long arr[(int)1e5 + 5], n, u;
void solve() {
  cin >> n >> u;
  for (long long i = 0; i < n; i++) scanf("%lld", &arr[i]);
  ;
  double ans = -2.0;
  for (long long i = 0; i < n - 1; i++) {
    int ind = upper_bound(arr, arr + n, arr[i] + u) - arr;
    ind--;
    if (ind > i + 1) {
      ans = max(ans, 1.0 * (arr[ind] - arr[i + 1]) / (1.0 * arr[ind] - arr[i]));
    }
  }
  if (ans < 0) {
    cout << -1 << endl;
  } else {
    printf("%.10lf\n", ans);
  }
}
int main() {
  solve();
  return 0;
}
