#include <bits/stdc++.h>
using namespace std;
const int N = 3000005;
int arr[N], n, k;
int main() {
  scanf("%d %d", &n, &k);
  int l = N;
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    arr[a]++;
    l = min(l, a);
  }
  for (int i = 1; i < N; i++) arr[i] += arr[i - 1];
  if (l <= k + 1) {
    printf("%d\n", l);
    return 0;
  }
  for (int i = l; i; i--) {
    int c = 0;
    for (int j = i; j + k < N; j += i) {
      c += arr[j + k] - arr[j - 1];
    }
    if (c == n) {
      printf("%d\n", i);
      return 0;
    }
  }
  return 0;
}
