#include <bits/stdc++.h>
using namespace std;
int n, k, minval;
int a[1000000 + 10];
void solve() {
  int i, j, ans, dau, cuoi;
  bool flag;
  for (i = 1; i <= 1000000; i++) a[i] += a[i - 1];
  ans = 1;
  for (i = 2; i <= minval; i++) {
    flag = true;
    for (j = 0; j <= 1000000 && flag; j += i) {
      dau = j + k;
      cuoi = j + i - 1;
      dau = min(dau, 1000000);
      cuoi = min(cuoi, 1000000);
      if (a[cuoi] - a[dau] > 0) flag = false;
    }
    if (flag) ans = max(ans, i);
  }
  printf("%d\n", ans);
}
void input() {
  int i, x;
  scanf("%d %d", &n, &k);
  minval = 1e9;
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x] = 1;
    minval = min(minval, x);
  }
  solve();
}
int main() {
  input();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
