#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)3e5 + 10;
const long long oo = 10000000000000ll;
int n, a[maxn], k, res = (int)1e7;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    res = min(res, a[i]);
  }
  int i;
  while (res) {
    for (i = 1; i <= n; i++)
      while (a[i] % res > k) res--;
    for (i = 1; i <= n + 1; i++)
      if (a[i] % res > k) break;
    if (i > n) {
      printf("%d\n", res);
      return 0;
    }
  }
  return 0;
}
