#include <bits/stdc++.h>
using namespace std;
int fre[1000003];
int main() {
  int i, j, n, k, mn = 1000003, a, ans;
  scanf("%d %d", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    mn = min(mn, a);
    fre[a]++;
  }
  if (mn <= k + 1) {
    printf("%d\n", mn);
    return 0;
  }
  for (i = 1; i < 1000003 - 2; i++) fre[i] += fre[i - 1];
  for (i = 1000003 - 3; i > k; i--) {
    a = 0;
    for (j = i; j < 1000003 - 2; j += i) {
      mn = min(1000003 - 3, j + k);
      a += fre[mn] - fre[j - 1];
    }
    if (a == n) {
      ans = i;
      break;
    }
  }
  printf("%d\n", ans);
  return 0;
}
