#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, minn = 0x3fffffff;
  int a[3 * 100000 + 5];
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    minn = min(a[i], minn);
  }
  for (; minn > k; minn--) {
    int flag = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] % minn <= k) continue;
      while (a[i] % minn > k) minn--;
      minn++;
      flag = 1;
    }
    if (!flag) {
      cout << minn << endl;
      return 0;
    }
  }
  cout << minn << endl;
  return 0;
}
