#include <bits/stdc++.h>
int con = 10000001;
std::vector<int> p;
std::vector<int> cl;
std::vector<int> ns;
int s = 0;
std::set<int> flag_rows;
std::set<int> flag_columns;
int n;
int m;
int gotwo(int** mass, int or_, int row, int col) {
  int i;
  int j;
  if (or_ == 1) {
    for (j = 0; j < m; j++) {
      if (mass[row][j] == 1) {
        mass[row][j] = 2;
        flag_columns.insert(j);
        if (gotwo(mass, 0, row, j) == -1) return -1;
      }
      if (mass[row][j] == 0 and flag_columns.find(j) != flag_columns.end()) {
        return -1;
      }
    }
  }
  if (or_ == 0) {
    for (i = 0; i < n; i++) {
      if (mass[i][col] == 1) {
        mass[i][col] = 2;
        flag_rows.insert(i);
        if (gotwo(mass, 1, i, col) == -1) return -1;
      }
      if (mass[i][col] == 0 and flag_rows.find(i) != flag_rows.end()) {
        return -1;
      }
    }
  }
  return 0;
}
int main() {
  int i, j = 0, l_1, U, l_2, l_3;
  double k, max = -1;
  std::cin >> n;
  int* mass = new int[n];
  std::cin >> U;
  for (i = 0; i < n; i++) {
    std::cin >> mass[i];
  }
  for (i = 0; i < n; i++) {
    if (mass[i] - mass[i + 1] > U) {
      continue;
    } else {
      if (i + 2 > j) {
        if (i + 2 < n) {
          if (mass[i + 2] - mass[i] <= U) j = i + 2;
        } else {
          continue;
        }
      }
      while (mass[j] - mass[i] <= U and j < n) {
        j++;
      }
      j--;
      if (j == (i + 1) or j == i) {
        continue;
      }
      k = double((mass[j] - mass[i + 1])) / (mass[j] - mass[i]);
      if (k > max) {
        l_1 = i + 1;
        l_2 = i + 2;
        l_3 = j + 1;
        max = k;
      }
    }
  }
  printf("%.9f\n", max);
  return 0;
}
