#include <bits/stdc++.h>
int v[3 * 100005];
int count[2 * 1000005];
int main(void) {
  int n, k;
  int i, j;
  int best;
  int aux;
  int min;
  scanf(" %d %d", &n, &k);
  min = 0x3f3f3f3f;
  for (i = 0; i < n; i++) {
    scanf(" %d", &v[i]);
    if (v[i] < min) {
      min = v[i];
    }
    count[v[i]]++;
  }
  for (i = 1; i <= 2 * 1000000; i++) {
    count[i] += count[i - 1];
  }
  if (min <= k + 1) {
    best = min;
  } else {
    best = 1;
    for (i = 1000000; i >= 1; i--) {
      aux = 0;
      for (j = 1; j * i + k <= 2 * 1000000; j++) {
        aux += count[j * i + k] - count[j * i - 1];
      }
      if (aux == n) {
        best = i;
        break;
      }
    }
  }
  printf("%d\n", best);
  return 0;
}
