#include <bits/stdc++.h>
using namespace std;
template <typename S, typename T>
ostream& operator<<(ostream& out, pair<S, T> const& p) {
  out << '(' << p.first << ", " << p.second << ')';
  return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> const& v) {
  long long l = v.size();
  for (long long i = 0; i < l - 1; i++) out << v[i] << ' ';
  if (l > 0) out << v[l - 1];
  return out;
}
template <typename T>
void trace(const char* name, T&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  trace(comma + 1, args...);
}
const long long N = 1e6 + 100;
long long n, k, arr[N], cumu[2 * N];
long long get(long long a) {
  if (cumu[a - 1] != 0) {
    return 0;
  }
  long long cnt = 0;
  for (long long i = a; i < N; i += a) {
    long long temp = min(i + k, i + a - 1);
    cnt += (cumu[temp] - cumu[i - 1]);
  }
  return cnt;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    cumu[arr[i]]++;
  }
  for (long long i = 1; i < 2 * N; i++) {
    cumu[i] = cumu[i - 1] + cumu[i];
  }
  long long ans = 1;
  for (long long i = 2; i < N; i++) {
    if (get(i) == n) {
      ans = i;
    }
  }
  cout << ans << "\n";
}
