#include <bits/stdc++.h>
using namespace std;
int dp[3000001], arr[1000001];
int main() {
  int n, k, mx = 0, ans;
  cin >> n >> k;
  int mn = 1000001;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    mn = min(mn, arr[i]);
    mx = max(mx, arr[i]);
    dp[arr[i]]++;
  }
  for (int i = 1; i <= 3000000; i++) {
    dp[i] = dp[i] + dp[i - 1];
  }
  if (mn <= k + 1) {
    cout << mn;
    return 0;
  }
  for (int d = k + 1; d <= mn; d++) {
    int ct = 0;
    for (int j = 1; j <= mx / d; j++) {
      ct += dp[j * d + k] - dp[j * d - 1];
    }
    if (ct == n) {
      ans = d;
    }
  }
  cout << ans << endl;
  return 0;
}
