#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
int a[N], n, k, ans;
int main() {
  ans = 1e6 + 100;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), ans = min(ans, a[i]);
  int tmp;
  while (ans) {
    tmp = ans;
    for (int i = 1; i <= n; ++i)
      while (a[i] % tmp > k) --tmp;
    if (ans == tmp) {
      printf("%d", ans);
      return 0;
    }
    ans = tmp;
  }
  return 0;
}
