#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k, ans = 0;
  cin >> n >> k;
  vector<int> a(n), cnt(2000005);
  for (int& i : a) {
    cin >> i;
    ++cnt[i];
  }
  int m = *min_element(a.begin(), a.end()),
      mx = *max_element(a.begin(), a.end());
  for (int i = 1; i < 2000005; ++i) cnt[i] += cnt[i - 1];
  if (m < k + 1) {
    cout << m;
    return 0;
  }
  for (int d = k + 1; d <= m; ++d) {
    int c = 0;
    for (int i = 1; i <= mx / d; ++i) c += cnt[d * i + k] - cnt[d * i - 1];
    if (c == n) ans = max(ans, d);
  }
  cout << ans;
  return 0;
}
