#include <bits/stdc++.h>
using namespace std;
int a[311111];
int main(void) {
  int n, k;
  scanf("%d%d", &n, &k);
  int mx = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    mx = max(mx, a[i]);
  }
  sort(a, a + n);
  for (int i = mx; i >= 1; i--) {
    int what = 0;
    for (int j = i; j <= mx; j += i) {
      int p1 = lower_bound(a, a + n, j) - a;
      int p2 = upper_bound(a, a + n, j + k) - a;
      if (what < p1) break;
      what = p2;
    }
    if (what == n) {
      printf("%d", i);
      return 0;
    }
  }
}
