#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 0, 1, -1, 1, 1, -1};
template <class T>
inline bool get(T& n) {
  char c, mul = 1;
  n = 0;
  while (!isdigit(c = getchar_unlocked()) && (c != EOF) && (c != '-'))
    ;
  if (c == EOF) return false;
  if (c == '-') {
    c = getchar_unlocked();
    mul = -1;
  }
  for (; isdigit(c); c = getchar_unlocked()) n = n * 10 + c - '0';
  n *= mul;
  return true;
}
inline void get(char& c) {
  while (isspace(c = getchar_unlocked()))
    ;
}
int n, k;
int v[300000];
int mini = 0x3f3f3f;
int main() {
  get(n);
  get(k);
  for (int(i) = 0, _ = (n); (i) < _; ++i) get(v[i]);
  sort(v, v + n);
  for (int(i) = (v[0]), _ = (2); (i) >= _; --(i)) {
    int nex = 0;
    bool can = true;
    for (int j = i; can && nex < n; j += i) {
      if (v[nex] < j) can = false;
      nex = lower_bound(v + nex, v + n, j + k + 1) - v;
    }
    if (can) {
      printf("%d\n", i);
      return 0;
    }
  }
  printf("1\n");
  return 0;
}
