#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 10;
long long cnt[maxn];
int main() {
  long long n, k, mn = maxn, mx = 0;
  cin >> n >> k;
  for (long long i = 0, a; i < n; i++) {
    cin >> a;
    cnt[a]++;
    mn = min(a, mn);
    mx = max(a, mx);
  }
  if (mn <= k) return cout << mn, 0;
  for (long long i = 1; i < maxn; i++) cnt[i] += cnt[i - 1];
  for (long long i = mn; i > 0; i--) {
    long long count = 0;
    count += cnt[k];
    for (long long j = 1; j <= mx / i; j++)
      count += cnt[min(j * i + k, maxn - 1)] - cnt[j * i - 1];
    if (count == n) return cout << i, 0;
  }
  return 0;
}
