#include <bits/stdc++.h>
using namespace std;
const int MM = 1e6 + 1, MOD = 1e9 + 7;
int N, K, psa[MM], ans = 1;
int sum(int l, int r) {
  r = min(r, (int)1e6);
  return psa[r] - psa[l - 1];
}
int32_t main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> N >> K;
  for (int i = 1, x; i <= N; ++i) cin >> x, psa[x]++;
  for (int i = 1; i <= 1e6; ++i) psa[i] += psa[i - 1];
  for (int i = 2, ct = 0; i <= 1e6; ++i, ct = 0) {
    for (int j = i; j <= 1e6; j += i) ct += sum(j, min(j + i - 1, j + K));
    if (ct == N) ans = i;
  }
  cout << ans << "\n";
}
