#include <bits/stdc++.h>
using namespace std;
int sum[1000007], a, n, k;
int main() {
  while (~scanf("%d%d", &n, &k)) {
    memset(sum, 0, sizeof(sum));
    int maxn = -1, minn = 1000007;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a);
      sum[a]++;
      maxn = max(maxn, a);
      minn = min(minn, a);
    }
    for (int i = 1; i <= maxn; i++) sum[i] += sum[i - 1];
    int i;
    if (minn <= k + 1) {
      printf("%d\n", minn);
      continue;
    }
    for (i = maxn; i >= k + 1; i--) {
      int m = 0;
      for (int j = 1; j <= maxn / i; j++) {
        int l = j * i;
        int r = min(j * i + k, maxn);
        m += sum[r] - sum[l - 1];
      }
      if (m == n) break;
    }
    printf("%d\n", i);
  }
}
