#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, u;
  cin >> n >> u;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int i = 1;
  vector<int> index(n);
  int j = 1;
  while (i < n - 1) {
    while (j < n && v[i - 1] + u >= v[j]) {
      j++;
    }
    j--;
    j = max(j, i);
    index[i] = v[j];
    i++;
  }
  int a;
  int s;
  bool flag = false;
  double ans = -1;
  for (int i = 0; i < n - 2; i++) {
    if (index[i + 1] != v[i + 1]) {
      flag = true;
      a = index[i + 1] - v[i + 1];
      s = v[i + 1] - v[i];
      ans = max(ans, (a) / (double)(s + a));
    }
  }
  if (flag)
    printf("%.9f", ans);
  else
    cout << -1;
}
