#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e7 + 1000;
int n, k, dp[maxN], tmp, a[maxN], MIN = maxN, MAX = -1, ans = 1;
int main() {
  scanf("%d%d", &n, &k);
  for (int(i) = (0); (i) < (int)n; ++(i)) {
    scanf("%d", &tmp);
    a[tmp]++;
    MAX = max(MAX, tmp);
    MIN = min(MIN, tmp);
  }
  for (int(i) = (1); (i) < (int)maxN - 55; ++(i)) dp[i] = dp[i - 1] + a[i];
  for (int i = MIN; i > 1; i--) {
    int dis = min(i - 1, k);
    int cnt = 0;
    for (int j = i; j <= MAX; j += i) cnt += dp[j + dis] - dp[j - 1];
    if (cnt == n) {
      printf("%d\n", i);
      return 0;
    }
  }
  printf("%d\n", 1);
  return 0;
}
