#include <bits/stdc++.h>
using namespace std;
int a[333333], cnt[2000001], n, k, ans, minval, maxval;
int main() {
  cin >> n >> k;
  minval = 2e9;
  maxval = -2e9;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    minval = min(minval, a[i]);
    maxval = max(maxval, a[i]);
    cnt[a[i]]++;
  }
  if (minval <= k + 1) return cout << minval << endl, 0;
  for (int i = 0; i < minval + maxval; i++) cnt[i + 1] += cnt[i];
  for (int i = minval;; i--) {
    int cntt = 0;
    for (int j = i; j <= maxval; j += i) cntt += cnt[j + k] - cnt[j - 1];
    if (cntt == n) return cout << i << endl, 0;
  }
}
