#include <bits/stdc++.h>
using namespace std;
const int N = 2000000;
int n, k;
int ara[N + 5];
int freq[N + 5], cum[N + 5];
int main() {
  scanf("%d %d", &n, &k);
  int mn = 1e9;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &ara[i]);
    freq[ara[i]]++;
    mn = min(mn, ara[i]);
  }
  for (int i = 1; i <= N; i++) cum[i] = cum[i - 1] + freq[i];
  for (int root = mn; root >= 1; root--) {
    int got = 0;
    if (k >= root - 1)
      got = n;
    else {
      for (int num = root; num + k <= N; num += root) {
        got += cum[num + k] - cum[num - 1];
        if (cum[num + k] > got) break;
      }
    }
    if (got == n) {
      printf("%d\n", root);
      return 0;
    }
  }
}
