#include <bits/stdc++.h>
using namespace std;
const int N = 2000200;
bool Ch(int Ans);
int n, k;
int a[N];
int c[N];
int p[N];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) scanf("%d", a + i), c[a[i]]++;
  for (int i = 1; i < N; i++) p[i] = c[i] + p[i - 1];
  sort(a + 1, a + n + 1);
  for (int Ans = a[1]; Ans >= 1; Ans--)
    if (Ch(Ans)) return cout << Ans, 0;
  assert(0);
}
bool Ch(int Ans) {
  if (Ans <= k + 1) return true;
  for (int j = Ans + Ans; j <= N; j += Ans)
    if (p[j - 1] - p[j - Ans + k]) return false;
  return true;
}
