#include <bits/stdc++.h>
using namespace std;
const int mx[4] = {1, -1, 0, 0};
const int my[4] = {0, 0, 1, -1};
const int Nmax = 3;
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a.begin() + 1, a.end());
  int ans = a[1];
  while (ans) {
    bool t = 1;
    for (int i = 1; i <= n; i++)
      if (a[i] % ans > k) {
        while (ans && a[i] % ans > k) ans--;
        t = 0;
        break;
      }
    if (t) break;
  }
  cout << ans << endl;
  return 0;
}
