#include <bits/stdc++.h>
using namespace std;
const int limN = 1e5 + 5;
int main() {
  long double ans = -1.0;
  int N, U;
  int nums[limN];
  scanf("%d%d", &N, &U);
  for (int i = 0; i < N; i++) scanf("%d", &nums[i]);
  for (int i = 0, j = i + 1; i + 2 < N; i++, j++) {
    int k = upper_bound(nums, nums + N, nums[i] + U) - nums;
    k--;
    if (k > j && k < N && nums[i] - nums[k] <= U)
      ans = max(ans, ((long double)(nums[k] - nums[j])) / (nums[k] - nums[i]));
  }
  if (ans == -1.0)
    printf("-1\n");
  else
    printf("%.12Lf\n", ans);
}
