#include <bits/stdc++.h>
using namespace std;
int n, k, s;
int n1[300050];
int vis[2000050];
int pr;
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) scanf("%d", &n1[i]), vis[n1[i]] = 1;
  sort(n1, n1 + n);
  for (int i = 1; i <= 2000001; i++) vis[i] += vis[i - 1];
  s = vis[1000001];
  if (n1[0] <= k)
    printf("%d", n1[0]);
  else {
    pr = k;
    for (int i = k + 1; i <= n1[0]; i++) {
      int sh = 0;
      for (int j = i; j <= 1000000; j += i) {
        sh += vis[j + k] - vis[j - 1];
      }
      if (sh == s) pr = i;
    }
    printf("%d", pr);
  }
  return 0;
}
