#include <bits/stdc++.h>
using namespace std;
int n, k, a[3000000];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  int mini = 2000000;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    mini = min(mini, x);
    a[max(1, x - k)]++;
    a[x + 1]--;
  }
  for (int i = 1; i <= 1500000; i++) a[i] += a[i - 1];
  for (int i = 1000000; i >= k + 1; i--) {
    int sum = 0;
    for (int j = 0; j <= 1000000; j += i) sum += a[j];
    assert(sum <= n);
    if (sum == n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << mini << endl;
}
