#include <bits/stdc++.h>
using namespace std;
const int M = 1000010;
int sum[M], n, k, x, ans = INT_MAX;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    int idx = max(0, x - k);
    sum[idx]++;
    sum[x + 1]--;
    ans = min(ans, x);
  }
  for (int i = 1; i < M - 5; i++) sum[i] += sum[i - 1];
  for (int i = ans; i >= 1; i--) {
    int cnt = 0;
    for (int j = 0; j < M - 5; j += i) cnt += sum[j];
    if (cnt == n) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
