#include <bits/stdc++.h>
using namespace std;
int a[300100];
int s[1100000];
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  int mx = 0, mn = 1000000000;
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    s[a[i]]++;
    mx = max(mx, a[i]);
    mn = min(mn, a[i]);
  }
  for (int i = 1; i < 1100000; i++) s[i] += s[i - 1];
  for (int i = mn; i >= 1; i--) {
    int cur = 0;
    for (int j = i; j < 1100000; j += i)
      cur += s[min(1100000 - 1, min(j + i - 1, j + k))] - s[j - 1];
    if (cur == n) {
      printf("%d\n", i);
      return 0;
    }
  }
}
