#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using dd = long double;
namespace {
static bool constexpr dbg = 0;
ll constexpr N = 2.1e6;
ll n, k, a[N], cnt[N];
void init() {
  cin >> n >> k;
  for (ll i = 1; i <= (ll)(n); ++i) cin >> a[i];
}
void solve() {
  ll mn = LONG_LONG_MAX, mx = LONG_LONG_MIN;
  for (ll i = 1; i <= (ll)(n); ++i) {
    mn = min(mn, a[i]);
    mx = max(mx, a[i]);
    ++cnt[a[i]];
  }
  for (ll i = 1; i <= (ll)(N - 1); ++i) cnt[i] += cnt[i - 1];
  if (mn <= k + 1) {
    cout << mn;
    return;
  }
  for (ll d = mn; d >= k + 1; --d) {
    ll cc = 0;
    for (ll i = 1; i <= mx / d; ++i) {
      ll i1 = d * i, i2 = d * i + k;
      cc += cnt[i2] - cnt[i1 - 1];
    }
    if (cc == n) {
      cout << d;
      return;
    }
  }
}
}  // namespace
int main() {
  if (!dbg) {
    std::ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  cout << fixed << setprecision(20);
  init();
  solve();
  return 0;
}
