#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9, MOD = INF + 7;
const long long N = 1e6 + 20;
long long a[N], cnt[N];
int32_t main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, k, mn = INF, mx = -INF;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
    mn = min(mn, a[i]), mx = max(mx, a[i]);
  }
  if (mn <= k + 1) return cout << mn << "\n", 0;
  for (long long i = 1; i < N; i++) cnt[i] += cnt[i - 1];
  for (long long i = mn, c = 0; i >= k + 1; i--, c = 0) {
    for (long long j = i; j <= mx; j += i)
      c += cnt[min(j + k, N - 1)] - cnt[j - 1];
    if (c == n) return cout << i << "\n", 0;
  }
  cout << "WTF"
       << "\n";
  return 0;
}
