#include <bits/stdc++.h>
using namespace std;
int a[1000006];
int main() {
  int n, m, i, x, j, s, r;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  for (i = 1; i < 1000001; i++) a[i] += a[i - 1];
  for (i = 1000000; i >= 1; i--) {
    s = 0;
    for (j = i; j <= 1000000; j += i) {
      r = min(j + m, j + i - 1);
      r = min(r, 1000000);
      s += a[r] - a[j - 1];
    }
    if (s == n) {
      printf("%d", i);
      return 0;
    }
  }
  return 0;
}
