#include <bits/stdc++.h>
using namespace std;
int a[3000000];
int main() {
  memset(a, 0, sizeof(a));
  int n, k;
  scanf("%d%d", &n, &k);
  int maxn = -1, minn = 0x3f3f3f3f;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
    maxn = max(x, maxn);
    minn = min(x, minn);
  }
  for (int i = 1; i <= maxn + k + 1; i++) {
    a[i] += a[i - 1];
  }
  if (minn <= k + 1)
    printf("%d\n", minn);
  else {
    for (int i = minn; i > 0; i--) {
      int ret = 0;
      for (int j = i; j <= maxn; j += i) {
        ret += a[j + k] - a[j - 1];
      }
      if (ret == n) {
        printf("%d\n", i);
        break;
      }
    }
  }
  return 0;
}
