#include <bits/stdc++.h>
using namespace std;
int n, k, mn = 1000006;
int v[1000006], vis[2 * 1000006];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", v + i);
    vis[v[i]]++;
    mn = (mn > v[i] ? v[i] : mn);
  }
  if (mn <= k) {
    printf("%d", mn);
    return 0;
  }
  for (int i = 1; i < 2 * 1000006; i++) vis[i] += vis[i - 1];
  for (int i = mn; i > k; i--) {
    int sm = 0;
    for (int h = i; h < 1000006; h += i) sm += vis[h + k] - vis[h - 1];
    if (sm == n) {
      printf("%d", i);
      return 0;
    }
  }
}
