#include <bits/stdc++.h>
using namespace std;
const int MAXM = 1000010;
int sum[MAXM];
int getsum(int l, int r) {
  if (l >= MAXM) {
    return 0;
  }
  if (r >= MAXM) {
    r = MAXM - 1;
  }
  return sum[r] - sum[l - 1];
}
int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    int tmp;
    scanf("%d", &tmp);
    sum[tmp]++;
  }
  int minnum = MAXM;
  for (int i = 1; i < MAXM; i++) {
    if (sum[i] != 0) {
      minnum = min(minnum, i);
    }
    sum[i] += sum[i - 1];
  }
  for (int ans = minnum; ans > 0; ans--) {
    bool mark = true;
    for (int x = ans; x < MAXM; x += ans) {
      int l = x + k + 1, r = x + ans - 1;
      if (l > r) {
        continue;
      }
      if (getsum(l, r) > 0) {
        mark = false;
        break;
      }
    }
    if (mark == true) {
      printf("%d\n", ans);
      break;
    }
  }
  return 0;
}
