#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, u, i, j, f = 0;
  scanf("%lld %lld", &n, &u);
  long long int a[n + 1];
  double ef = 0.0, ans = 0.0;
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  a[0] = 0;
  a[n + 1] = 999999999999999;
  for (j = 2; j <= n - 1; j++) {
    long long int start = j + 1;
    long long int end = n;
    long long int mid;
    long long int val = a[j - 1] + u;
    long long int in = 0;
    while (end >= start) {
      mid = (start + end) / 2;
      if (a[mid] == val) {
        in = mid;
        break;
      }
      if (a[mid] > val && a[mid - 1] < val) {
        in = mid - 1;
        break;
      }
      if (a[mid] < val && a[mid + 1] > val) {
        in = mid;
        break;
      }
      if (a[mid] > val) {
        end = mid - 1;
      } else
        start = mid + 1;
    }
    val = a[in];
    if (in != 0 && val <= a[j - 1] + u && in > j) {
      f = 1;
      ans = ((val - a[j]) / ((val - a[j - 1]) * 1.0));
      if (ans > ef) ef = ans;
    }
  }
  if (f == 1)
    printf("%.9lf", ef);
  else
    printf("-1");
}
