#include <bits/stdc++.h>
using namespace std;
int i, n, k, m, a[300008], f;
int main() {
  cin >> n >> k;
  for (; i < n; i++) {
    cin >> a[i];
    if (!i || a[i] < m) {
      m = a[i];
    }
  }
  do {
    for (i = 0; i < n; i++) {
      f = 0;
      while (a[i] % m > k) {
        f = m--;
      }
    }
  } while (f);
  cout << m;
}
