#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 9;
int sum[maxn];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1, tmp; i <= n; i++) {
    scanf("%d", &tmp);
    sum[tmp]++;
  }
  for (int i = 1; i < maxn; i++) sum[i] += sum[i - 1];
  int i;
  for (i = maxn - 1; i >= 1; i--) {
    int ret = 0;
    for (int j = i; j < maxn; j += i) {
      ret += sum[min(maxn - 1, j + min(k, i - 1))] - sum[j - 1];
    }
    if (ret == n) break;
  }
  cout << i << endl;
  return 0;
}
