#include <bits/stdc++.h>
using namespace std;
int a[300005], p[1000005];
int main() {
  int n, k, mi = 2e9;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mi = min(mi, a[i]);
  }
  for (int i = 1; i <= n; i++) {
    p[max(1, a[i] - k)]++;
    p[a[i] + 1]--;
  }
  for (int i = 1; i <= 1000000; i++) {
    p[i] += p[i - 1];
  }
  int ans = min(k, mi);
  for (int i = k + 1; i <= mi; i++) {
    int num = 0;
    for (int j = i; j <= 1000000; j += i) {
      num += p[j];
    }
    if (num == n) {
      ans = max(ans, i);
    }
  }
  cout << ans << endl;
}
