#include <bits/stdc++.h>
using namespace std;
const int N = 1100000;
int n, k, x;
const int P = 1024 * 1024;
int drzewo[2 * P];
void update(int a) {
  a += P;
  while (a != 0) {
    drzewo[a]++;
    a /= 2;
  }
}
int sum(int a, int b) {
  a += P;
  b += P;
  int rez = 0;
  while (a + 1 < b) {
    if (a % 2 == 1) {
      rez += drzewo[a];
      a++;
    }
    if (b % 2 == 0) {
      rez += drzewo[b];
      b--;
    }
    a /= 2;
    b /= 2;
  }
  if (a != b) rez += drzewo[b];
  rez += drzewo[a];
  return rez;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    update(x);
    if (x <= k) {
      cout << x;
      return 0;
    }
  }
  int wyn = k;
  for (int i = k + 1; i <= 1000000; i++) {
    int suma = 0;
    for (int j = i; j <= 1000000; j += i) suma += sum(j, min(1000000, j + k));
    if (suma == n) wyn = i;
  }
  cout << wyn;
}
