#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> acc(1e6 + 1);
  {
    vector<int> cnt(1e6 + 1);
    for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      cnt[a]++;
    }
    for (int i = 1; i < 1e6 + 1; i++) {
      acc[i] = acc[i - 1] + cnt[i];
    }
  }
  int ans = 1;
  for (int gcd = 2; gcd < 1e6 + 1; gcd++) {
    if (acc[gcd - 1] > 0) {
      break;
    }
    int lb = gcd + k + 1;
    int ub = min((int)1e6 + 1, 2 * gcd);
    if (lb < ub) {
      bool ok = true;
      while (lb <= 1e6) {
        if (acc[ub - 1] - acc[lb - 1] > 0) {
          ok = false;
          break;
        }
        lb += gcd;
        ub = min((int)1e6 + 1, ub + gcd);
      }
      if (ok) {
        ans = gcd;
      }
    } else {
      ans = gcd;
    }
  }
  cout << ans << '\n';
}
