#include <bits/stdc++.h>
using namespace std;
const int N = 2000002;
int n, k, first[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (1); i <= (int)(n); ++i) {
    int x;
    scanf("%d", &x);
    ++first[x];
  }
  for (int i = (N - 2); i >= (int)(0); --i) first[i] += first[i + 1];
  int ans = 1;
  for (int i = (2); i <= (int)(N - 2); ++i) {
    int cnt = 0;
    for (int j = i; j < N; j += i)
      cnt += first[j] - first[min(j + min(i, k + 1), N - 1)];
    if (cnt == n) ans = max(ans, i);
  }
  cout << ans;
}
