#include <bits/stdc++.h>
using namespace std;
long long n, k, m = 0x7fffffff, a[1000000];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    m = min(m, a[i]);
  }
  for (int j = 1; j <= 3; j++) {
    for (int i = 1; i <= n; i++)
      while (a[i] % m > k) m--;
  }
  cout << m;
  return 0;
}
