#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, Max = 1e6;
  int a[300005];
  cin >> n >> k;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
    Max = min(Max, a[i]);
  }
  bool flag = false;
  while (!flag) {
    flag = true;
    for (i = 0; i < n; ++i)
      while (a[i] % Max > k) --Max, flag = false;
  }
  cout << Max << endl;
  return 0;
}
