#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int u;
  cin >> n >> u;
  int e[n];
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf(" %d", &tmp);
    e[i] = tmp;
  }
  int tail = 0, front = 2;
  double ans = 0;
  while (true) {
    if (front - tail < 2 && front == n - 1) break;
    while (e[front + 1] - e[tail] <= u && front < n - 1) {
      front++;
    }
    double shit = 1.0 * (e[front] - e[tail + 1]) / (e[front] - e[tail]);
    if (e[front] - e[tail] <= u && (e[front] - e[tail]) != 0)
      ans = ans > shit ? ans : shit;
    tail++;
  }
  if (ans == 0) ans = -1;
  if (ans != -1)
    printf("%.10f\n", ans);
  else
    cout << -1 << endl;
}
