#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
int n, k, res, sum[MAXN], l = MAXN, r;
int main() {
  scanf("%d%d", &n, &k);
  for (int w, i = 1; i <= n; ++i) {
    scanf("%d", &w);
    ++sum[w];
    l = min(l, w);
    r = max(r, w);
  }
  if (l <= k + 1) {
    printf("%d", l);
    return 0;
  }
  for (int i = 1; i <= r; ++i) sum[i] += sum[i - 1];
  for (res = r; res >= k + 1; --res) {
    int num = 0;
    for (int i = 1; i <= r / res; ++i)
      num += sum[min(i * res + k, r)] - sum[i * res - 1];
    if (num == n) break;
  }
  printf("%d", res);
  return 0;
}
