#include <bits/stdc++.h>
using namespace std;
long long c_sum(long long num) {
  long long sum = 0, count = 0;
  while (num != 0) {
    sum = sum + num % 10;
    num = num / 10;
    count++;
  }
  if (count > 1)
    return (1 + c_sum(sum));
  else
    return 0;
}
double mint(double a, double b) {
  if (a < b)
    return b;
  else
    return a;
}
int main() {
  long long n, u, x;
  double maxi = 0.0;
  std::vector<int> v;
  cin >> n >> u;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    v.push_back(x);
  }
  for (int i = 0; i < n - 2; ++i) {
    x = lower_bound(v.begin(), v.end(), v[i] + u + 1) - v.begin() - 1;
    maxi = mint(maxi, (v[x] - v[i + 1]) * 1.0 / (v[x] - v[i]));
  }
  cout << setprecision(20);
  if (maxi == 0.0) {
    cout << -1;
    return 0;
  }
  cout << maxi;
}
