#include <bits/stdc++.h>
using namespace std;
int a[300001];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  sort(a, a + n);
  int gcd = a[0];
  for (int i = 1; i < n; i++) {
    while (a[i] % gcd > k) gcd--;
  }
  for (int i = n - 1; i >= 0; i--) {
    while (a[i] % gcd > k) gcd--;
  }
  cout << gcd;
  return 0;
}
