#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300000 + 50;
const int MAXS = 10000 + 50;
const int sigma_size = 26;
const long long LLMAX = 0x7fffffffffffffffLL;
const long long LLMIN = 0x8000000000000000LL;
const int INF = 0x7fffffff;
const int IMIN = 0x80000000;
const int inf = 1 << 30;
const long long MOD = 1000000000 + 7;
const int mod = 100000;
const double PI = acos(-1.0);
int a[MAXN], n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); i++) scanf("%d", &a[i]);
  sort(a, a + n);
  int ans = a[0], b;
  while (1) {
    for (b = 0; b < n; b++) {
      if (a[b] % ans > k) {
        ans = a[b] / (a[b] / ans + 1);
        break;
      }
    }
    if (b == n) break;
  }
  printf("%d\n", ans);
  return 0;
}
