#include <bits/stdc++.h>
using namespace std;
const long long sz = 1e6;
vector<long long> a(300500, 0), pref(2 * sz + 50, 0), exist(2 * sz + 50, 0);
long long n, k;
long long MIN = 1e18;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  long long i, j;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    MIN = min(MIN, a[i]);
    exist[a[i]]++;
  }
  pref[0] = 0;
  for (i = 1; i <= 2 * sz + 10; i++) pref[i] = pref[i - 1] + exist[i];
  for (i = MIN; i >= 1; i--) {
    long long sum = 0;
    long long LastCovered = 1;
    for (j = 1;; j++) {
      long long start = i * j;
      start = max(start, LastCovered);
      long long finish = i * j + k;
      if (finish > 2 * sz || start > sz) break;
      sum += (pref[finish] - pref[start - 1]);
      LastCovered = finish + 1;
    }
    if (sum == n) {
      cout << i;
      return 0;
    }
  }
  cout << 1;
  return 0;
}
