#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const int maxk = 1e6 + 5;
int n, k;
int a[maxn];
int b[maxn];
int getn() {
  int r = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) r = r * 10 + c - '0', c = getchar();
  return r;
}
int low[maxk];
int upp[maxk];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) a[i] = getn();
  sort(a + 1, a + 1 + n);
  n = unique(a + 1, a + 1 + n) - a - 1;
  for (int i = 1; i <= n; i++) b[i] = max(1, a[i] - k);
  int ans = 1;
  for (int i = 2; i <= a[1]; i++) {
    int cur = 0, ok = 1;
    for (int j = i; j <= a[n]; j += i) {
      int l, r;
      if (!low[j])
        l = low[j] = lower_bound(a + 1, a + 1 + n, j) - a;
      else
        l = low[j];
      if (!upp[j])
        r = upp[j] = upper_bound(b + 1, b + 1 + n, j) - b - 1, 1;
      else
        r = upp[j];
      if (!(l <= cur + 1 && cur <= r)) {
        ok = 0;
        break;
      } else {
        cur = max(cur, r);
      }
    }
    if (ok && cur == n) ans = max(ans, i);
  }
  cout << ans << endl;
  return 0;
}
