#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)1e18;
const long long mod = (long long)1e9 + 7;
const double eps = (double)1e-9;
const double pi = acos(-1.0);
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
const int N = 1000500;
int n, k, mn = N, p[N];
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    p[x]++;
    mn = min(mn, x);
  }
  if (mn <= k + 1) {
    cout << mn;
    return 0;
  }
  for (int i = 1; i <= (int)1e6; i++) p[i] += p[i - 1];
  for (int i = mn; i > k; i--) {
    int cnt = 0;
    for (int j = i; j <= (int)1e6; j += i)
      cnt += p[min((int)1e6, j + k)] - p[j - 1];
    if (cnt == n) {
      cout << i;
      return 0;
    }
  }
  assert(0);
  return 0;
}
