#include <bits/stdc++.h>
using namespace std;
void read(int &a) {
  a = 0;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  int f = 1;
  if (ch == '-') f = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') a = a * 10 + ch - 48, ch = getchar();
  a = a * f;
}
void read(long long &a) {
  a = 0;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  int f = 1;
  if (ch == '-') f = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') a = a * 10 + ch - 48, ch = getchar();
  a = a * f;
}
void write(int a) {
  if (!a) return;
  if (a < 0)
    putchar('-'), write(-a);
  else
    write(a / 10), putchar(a % 10 + 48);
}
void write(long long a) {
  if (!a) return;
  if (a < 0)
    putchar('-'), write(-a);
  else
    write(a / 10), putchar(a % 10 + 48);
}
int n, m, a[1000005];
int main() {
  read(n), read(m);
  for (int i = (1); i <= (n); ++i) read(a[i]);
  int j = 1;
  double ans = -1;
  for (int i = (1); i <= (n); ++i) {
    while (j <= n && a[j] - a[i] <= m) ++j;
    if (j - 2 <= i) continue;
    ans = max(ans, 1.0 * (a[j - 1] - a[i + 1]) / (a[j - 1] - a[i]));
  }
  if (ans < -0.5)
    puts("-1");
  else
    printf("%.10lf\n", ans);
  return 0;
}
