#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\t";
  err(++it, args...);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& c, pair<T1, T2>& v) {
  c << "(" << v.first << "," << v.second << ")";
  return c;
}
template <template <class...> class TT, class... T>
ostream& operator<<(ostream& out, TT<T...>& c) {
  out << "{ ";
  for (auto& x : c) out << x << " ";
  out << "}";
  return out;
}
const int N = 1e6 + 5, MOD = 1e9 + 7;
int cnt[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  int mn = N;
  for (int i = 0, x; i < n; i++) {
    cin >> x;
    cnt[x]++;
    mn = min(mn, x);
  }
  if (mn <= k + 1) return cout << mn, 0;
  for (int i = 1; i < N; i++) cnt[i] += cnt[i - 1];
  for (int i = N - 1; i >= k + 1; i--) {
    int tot = 0;
    for (int j = i; j < N; j += i) tot += cnt[min(j + k, N - 1)] - cnt[j - 1];
    if (tot == n) return cout << i, 0;
  }
}
