9 5
.....
#....
..#..
.....
.#..#
...#.
.#...
....#
.....
 4 10
..#......#
.....##...
#.........
.#.......#
 50 2
..
..
#.
..
.#
..
..
..
.#
..
..
.#
##
..
..
..
.#
..
..
.#
..
..
.#
..
..
.#
..
.#
..
.#
..
.#
.#
.#
..
..
..
.#
.#
.#
..
..
.#
.#
..
..
..
..
..
..
 2 50
...#.##.###...#.#..##....##..........#.#..#.#####.
...#.##.###...#.#..##....##..........#.#..#.#####.
 1 1
#
 3 3
.##
#.#
##.
 50 8
.....#..
........
........
.....#..
.....#..
........
........
........
........
...#....
...#....
........
...#....
#.#.#...
...#....
...#....
........
...#....
...#....
...#....
........
#.#.#...
.....#..
........
#.#.#...
#.#.#...
#.#.#...
...#....
........
........
........
#.#.#...
........
.....#..
........
........
........
........
........
........
.....#..
........
........
........
.....#..
#.#.#...
...#....
........
........
........
 1 1
.
 25 16
.............#..
.............#..
.......#...#....
............#...
.....#..........
.....#..........
#...............
................
........#.......
................
................
.#..............
#...............
.....#..........
.#..............
............#...
................
................
................
........#.......
..#.............
..........#.....
.......#...#....
.............#..
..........#.....
 25 16
..............#.
................
...#...#........
........#.#.....
..............##
..............#.
.......#........
......#.........
............#...
.........#.....#
..............#.
.......#........
#...........#...
...#.#..........
.#..............
................
......#.....#...
.......#........
........#.....#.
................
......#.........
..#.............
................
...#.#..........
.#..............
 10 15
.......#.......
.....#.........
....#..........
....#..........
.....#.........
.....#.........
#.............#
...#..#........
...............
.............#.
 4 10
###..#..##
...##..#..
.##..#..#.
.........#
 2 5
.####
#..##
 5 2
##
##
..
##
..
 2 2
##
#.
 50 1
.
.
#
.
#
.
#
.
.
#
#
#
.
#
#
#
#
.
.
.
.
.
.
.
.
.
#
#
#
#
.
.
.
.
.
#
.
.
.
#
#
.
.
#
#
.
.
#
#
.
 5 2
#.
##
##
#.
..
 2 3
#.#
###
 2 1
.
#
 2 3
#.#
##.
 10 10
..........
..........
..........
..........
.#.......#
#.........
......#...
..........
..........
#.....#...
 4 4
###.
##.#
#.##
.###

No
 No
 No
 Yes
 Yes
 No
 Yes
 Yes
 Yes
 No
 Yes
 No
 No
 Yes
 No
 Yes
 No
 No
 Yes
 No
 No
 No

// clang-format off
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>  
#include <ext/pb_ds/tree_policy.hpp>   

using namespace std;
using namespace __gnu_pbds;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

/**TEMPLATE START: DEBUG PRINT -----------------------------------------------*/

#ifdef LOCAL
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, N, ...) N
#define _FE_1(_CALL, x) _CALL(x)
#define _FE_2(_CALL, x, ...) _CALL(x) _FE_1(_CALL, __VA_ARGS__)
#define _FE_3(_CALL, x, ...) _CALL(x) _FE_2(_CALL, __VA_ARGS__)
#define _FE_4(_CALL, x, ...) _CALL(x) _FE_3(_CALL, __VA_ARGS__)
#define _FE_5(_CALL, x, ...) _CALL(x) _FE_4(_CALL, __VA_ARGS__)
#define _FE_6(_CALL, x, ...) _CALL(x) _FE_5(_CALL, __VA_ARGS__)
#define FOR_EACH_MACRO(MACRO, ...)                                  \
    _NTH_ARG(__VA_ARGS__, _FE_6, _FE_5, _FE_4, _FE_3, _FE_2, _FE_1) \
    (MACRO, __VA_ARGS__)
#define watch(x) cerr << "\033[1;32m" #x " = \033[1;34m" << (x) << "\033[0m; ";
#define debug(...)                                         \
    cerr << "\033[2;31mLine " << __LINE__ << ": \033[0;m"; \
    FOR_EACH_MACRO(watch, __VA_ARGS__)                     \
    cerr << endl
#else
#define debug(...)
#endif

template <class T1, class T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '{' << p.first << ", " << p.second << '}';
}
template <class T, class = decltype(begin(declval<T>())),
          class = enable_if_t<!is_same<T, string>::value>>
ostream &operator<<(ostream &os, const T &c) {
    os << '[';
    for (auto it = begin(c); it != end(c); ++it)
        os << (it == begin(c) ? "" : ", ") << *it;
    return os << ']';
}
template <class T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
    os << "\n[\n";
    for (int i = 0; i < v.size(); i++) {
        os << v[i];
        os << '\n';
    }
    return os << ']';
}

/**TEMPLATE END: DEBUG PRINT -----------------------------------------------*/

/**TEMPLATE START: SHORT HAND -----------------------------------------------*/
#define pb                push_back
#define ppb               pop_back
#define all(x)            (x).begin(),(x).end()
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define FOR(i, a, b)      for(int i = (a); i < (b); i++)
#define FORE(i, a, b)     for(int i = (a); i <= (b); i++)
#define FORD(i, a, b)     for(int i = (a); i >= (b); i--)
#define FASTIO            ios_base::sync_with_stdio(false); cin.tie(NULL)
#define EPS               (double)(0.000000001)
#define INF               (long long)(1e18)
#define MOD               1000000007
#define MOD2              998244353
#define decimal(v, d)     fixed << setprecision(d) << v

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; 
/**TEMPLATE END: SHORT HAND -----------------------------------------------*/

/**TEMPLATE START: MISC -----------------------------------------------*/
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
/**TEMPLATE END: MISC -----------------------------------------------*/

void solve();

int32_t main() {
    FASTIO;
#ifndef ONLINE_JUDGE
    (void)!freopen("input.txt", "r", stdin);
    (void)!freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
        cout << "\n";
    }
    return 0;
}

// clang-format on

#define int long long

void solve()
{
    int n, u;
    cin >> n >> u;
    vector<int> a(n);
    for (int& i : a)
        cin >> i;

    double best = -1;

    FOR(i, 0, n)
    {
        int ei = a[i];
        int k = lower_bound(all(a), ei + u) - a.begin();
        if (k == n) {
            k--;
        }
        while (k > (i + 1) && a[k] > ei + u) {
            k--;
        }
        if (k > (i + 1) && a[k] <= ei + u) {
            best = max(best, (1.0 * (a[k] - a[i + 1]) / (a[k] - a[i])));
        }
    }
    cout << best;
}
