#include <bits/stdc++.h>
using namespace std;
const int mxN = 1e5 + 10;
vector<long long int> a(mxN);
int n;
int binarySearch(int low, int high, long long int val) {
  int answer;
  while (high >= low) {
    int mid = (low + high) / 2;
    if (a[mid] <= val) {
      answer = mid;
      low = mid + 1;
    } else {
      high = mid - 1;
    }
  }
  return answer;
}
int main() {
  long long int U;
  cin >> n >> U;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << setprecision(16) << fixed;
  double answer = -1;
  int left_anchor = 0;
  for (int i = 0; i < n; i++) {
    int curr = binarySearch(i, n - 1, a[i] + U);
    if (curr - i < 2) {
      continue;
    }
    double now = ((double)a[curr] - (double)a[i + 1]) /
                 ((double)a[curr] - (double)a[i]) * 1.0000000000;
    answer = max(answer, now);
  }
  if (answer == -1) {
    cout << "-1\n";
    return 0;
  }
  assert(answer != -1);
  cout << answer << "\n";
  return 0;
}
