#include <bits/stdc++.h>
using namespace std;
int sum[2000001];
int n, k, Max = -1;
bool check(int gap) {
  int last = 0;
  for (int i = gap; i <= Max; i += gap) {
    if (last < sum[i]) return false;
    last = sum[min(i + k + 1, Max + 1)];
  }
  if (last < sum[Max + 1]) return false;
  return true;
}
int main() {
  int d;
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &d);
    sum[d + 1] = 1;
    Max = max(Max, d);
  }
  for (int i = 1; i <= Max + 1; i++) sum[i] += sum[i - 1];
  int ans = 1;
  for (int i = 2; i <= Max; i++)
    if (check(i)) ans = i;
  printf("%d\n", ans);
  return 0;
}
