#include <bits/stdc++.h>
using namespace std;
int imos[1000002];
int main() {
  int n, k, mn = 10000000, ans;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    mn = min(mn, a);
    imos[max(1, a - k)]++;
    imos[a + 1]--;
  }
  if (mn <= k) {
    cout << mn;
    return 0;
  }
  ans = k;
  for (int i = 1; i < 1000001; i++) {
    imos[i] += imos[i - 1];
  }
  for (int i = k + 1; i < 1000001; i++) {
    int cnt = 0;
    for (int j = i; j < 1000001; j += i) {
      cnt += imos[j];
    }
    if (cnt == n) ans = i;
  }
  cout << ans;
  return 0;
}
