#include <bits/stdc++.h>
using namespace std;
int n, k, a, mn, mx;
int cnt[2000006];
int main() {
  int i, j;
  scanf("%d%d", &n, &k);
  mn = 1e7;
  mx = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    mn = min(mn, a);
    mx = max(mx, a);
    cnt[a]++;
  }
  for (i = 1; i <= mx + k; i++) cnt[i] += cnt[i - 1];
  for (i = mn; i >= 1; i--) {
    int s = 0;
    for (j = i; j <= mx; j += i) s += cnt[j + min(i - 1, k)] - cnt[j - 1];
    if (s == n) {
      printf("%d\n", i);
      return 0;
    }
  }
  return 0;
}
