#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:167772160")
const int INF = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.);
const int MX = 1005000;
int S[MX + 1];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int mn = INF;
  for (int i = 0; i < n; ++i) {
    int t;
    scanf("%d", &t);
    mn = min(mn, t);
    ++S[t];
  }
  for (int i = 1; i <= MX; ++i) {
    S[i] += S[i - 1];
  }
  int ans = min(k, mn);
  for (int i = k + 1; i <= mn; ++i) {
    int s = 0;
    for (int j = i; j < MX; j += i) {
      s += S[min(j + k, MX - 1)] - S[j - 1];
    }
    if (s == n) ans = i;
  }
  printf("%d\n", ans);
  return 0;
}
