#include <bits/stdc++.h>
using namespace std;
const long long inf = 1145141919810;
long long a[350001];
long long min(long long a, long long b) { return a < b ? a : b; }
int main() {
  long long n, k, ans = inf;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ans = min(ans, a[i]);
  }
  bool flag = 1;
  while (flag) {
    flag = 0;
    for (int i = 1; i <= n; i++) {
      while (a[i] % ans > k) {
        ans--;
        flag = 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
