#include <bits/stdc++.h>
using namespace std;
const int SIZE = 100000;
int arr[SIZE];
int main(int argc, char** argv) {
  int n, u, i, k;
  double ans, a, b;
  scanf("%d %d", &n, &u);
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  ans = -1.0;
  k = 2;
  for (i = 0; i < n - 2; i++) {
    while (k < n && arr[k] - arr[i] <= u) {
      k++;
    }
    k--;
    if (k > i + 1) {
      a = arr[k] - arr[i];
      b = arr[k] - arr[i + 1];
      ans = max(ans, b / a);
    }
  }
  if (ans < 0.0) {
    printf("-1\n");
  } else {
    printf("%.10f\n", ans);
  }
  return 0;
}
