#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1000010;
int N, A, Min = 4 * NMAX, Max, K, Cnt[NMAX];
int main() {
  scanf("%i %i", &N, &K);
  for (int i = 1; i <= N; ++i) {
    scanf("%i", &A);
    Cnt[A]++;
    Min = min(Min, A);
    Max = max(Max, A);
  }
  for (int i = 1; i < NMAX; ++i) Cnt[i] += Cnt[i - 1];
  if (Min <= K + 1)
    printf("%i", Min);
  else {
    for (int D = Min; D >= K + 1; D--) {
      int Total = 0;
      for (int i = 1; i * D <= NMAX; ++i)
        Total += Cnt[min(i * D + K, NMAX - 1)] - Cnt[i * D - 1];
      if (Total == N) {
        printf("%i", D);
        return 0;
      }
    }
  }
}
