#include <bits/stdc++.h>
using namespace std;
const int NN = 1e6;
int N, K;
int a[2000005], cnt[2000005], s[2000005];
int main() {
  scanf("%d%d", &N, &K);
  int m0 = 1e9;
  for (int i = 1; i <= N; i++) {
    scanf("%d", &a[i]);
    m0 = min(m0, a[i]);
    ++cnt[a[i]];
  }
  for (int i = 1; i <= NN + K; i++) {
    s[i] = s[i - 1] + cnt[i];
  }
  for (int i = m0; i >= 1; i--) {
    int n = 0;
    if (i <= K) {
      cout << i << endl;
      return 0;
    }
    for (int j = 0; j <= NN; j += i) {
      n += s[j + K] - s[max(0, j - 1)];
    }
    if (n == N) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}
