#include <bits/stdc++.h>
using namespace std;
int a[3000010], v[2 * 1000010 + 5];
int main() {
  int n, k, i, mn, ans, j;
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  mn = a[0];
  for (i = 1; i < n; i++) mn = min(mn, a[i]);
  if (mn <= k + 1) {
    cout << mn;
    return 0;
  }
  ans = k + 1;
  for (i = 0; i < n; i++) v[a[i]]++;
  for (i = 1; i <= 2 * 1000010; i++) v[i] += v[i - 1];
  for (i = k + 2; i <= mn; i++) {
    int cnt = 0;
    for (j = i; j <= 1000010; j += i) cnt += (v[j + k] - v[j - 1]);
    if (cnt == n) ans = i;
  }
  printf("%d\n", ans);
  return 0;
}
