#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1000001;
int cant[MaxN * 2], K;
bool possible(int A) {
  int i, j, p, q;
  for (i = A, p = cant[A]; i < MaxN; i += A) {
    q = cant[i + K];
    j = cant[i + A - 1];
    if (q < j) return false;
    p = cant[i + A];
  }
  return true;
}
int main() {
  cin.tie(0), ios_base::sync_with_stdio(0);
  int N, i, j, p, q = MaxN - 1;
  cin >> N >> K;
  for (i = 0; i < N; i++) {
    cin >> p;
    q = (p < q ? p : q);
    cant[p]++;
  }
  for (i = 1; i < MaxN * 2; i++) cant[i] += cant[i - 1];
  for (i = q; i >= 1; i--) {
    if (possible(i)) {
      cout << i;
      return 0;
    }
  }
}
