#include <bits/stdc++.h>
int cnt[2000006];
int main() {
  int n, k, mn, mx, res, total, a, i, j;
  while (scanf("%d %d", &n, &k) == 2) {
    memset(cnt, 0, sizeof(cnt));
    mn = 200000000;
    mx = -mn;
    for (i = 0; i < n; i++) {
      scanf("%d", &a);
      cnt[a]++;
      if (a < mn) mn = a;
      if (a > mx) mx = a;
    }
    for (i = 1; i <= mx + k; i++) cnt[i] += cnt[i - 1];
    res = 1;
    for (i = mn; i > 1; i--) {
      if (k >= i) {
        res = i;
        break;
      }
      total = 0;
      for (j = i; j <= mx; j += i) {
        total += cnt[j + k] - cnt[j - 1];
      }
      if (total == n) {
        res = i;
        break;
      }
    }
    printf("%d\n", res);
  }
  return 0;
}
