#include <bits/stdc++.h>
using namespace std;
int cnt[10000000] = {0};
int A[300010];
int mn = 1e9, mx = 0;
int main() {
  int n, k, i, j, sm, d, ans;
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; ++i) {
    scanf("%d", &A[i]);
    mn = min(mn, A[i]);
    mx = max(mx, A[i]);
    cnt[A[i]]++;
  }
  if (mn <= k + 1)
    ans = mn;
  else {
    for (i = 1; i <= 1000000; ++i) cnt[i] += cnt[i - 1];
    for (d = mn; d >= k + 1; d--) {
      sm = 0;
      int rng = mx / d;
      for (j = 1; j <= rng; j++) {
        if (j * d + k > mx) {
          sm += cnt[mx] - cnt[j * d - 1];
          break;
        } else
          sm += (cnt[j * d + k] - cnt[j * d - 1]);
      }
      if (sm == n) {
        ans = d;
        break;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
