#include <bits/stdc++.h>
using namespace std;
long long n, k;
inline bool check(vector<long long>& prev, long long x) {
  long long sz = prev.size();
  for (long long i = 0; i < sz; i += x) {
    long long j = min(i + x - 1, sz - 1);
    if (prev[j] - i > k) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  long long sz = a.back() + 10;
  vector<long long> cnt(sz, 0);
  for (long long i : a) cnt[i]++;
  vector<long long> prev(sz, 0);
  for (long long i = 1; i < sz; i++) {
    if (cnt[i] > 0)
      prev[i] = i;
    else
      prev[i] = prev[i - 1];
  }
  long long hi = a.front();
  for (long long i = hi; i >= 1; i--) {
    if (check(prev, i)) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}
