#include <bits/stdc++.h>
int main() {
  int count, U;
  std::cin >> count >> U;
  std::vector<int> e(count, 0);
  for (size_t i = 0; i < count; ++i) {
    std::cin >> e[i];
  }
  int to = 2;
  double max = -1;
  for (size_t from = 0; to < count; ++from) {
    while (to + 1 < count && e[to + 1] - e[from] <= U) {
      ++to;
    }
    if (to - from < 2) {
      to = from + 2;
      continue;
    }
    if (e[to] - e[from] <= U) {
      max = std::max(max, 1.0 * (e[to] - e[from + 1]) / (e[to] - e[from]));
    }
  }
  std::cout.precision(17);
  std::cout << max << std::endl;
  return 0;
}
