#include <bits/stdc++.h>
using namespace std;
const int M = 1000000;
int s[M + 3], n, K, L, ans;
bool check(int x) {
  int ss = 0;
  for (int i = 0; i <= L / x; i++)
    ss += s[min(M, i * x + K)] - s[max(i * x - 1, 0)];
  return ss == n;
}
int main() {
  scanf("%d%d", &n, &K);
  ans = 2e9;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    s[x]++;
    ans = min(ans, x);
    L = max(L, x);
  }
  if (ans <= K + 1) {
    printf("%d", ans);
    return 0;
  }
  for (int i = 1; i <= M; i++) s[i] += s[i - 1];
  for (; !check(ans); ans--)
    ;
  printf("%d", ans);
}
