#include <bits/stdc++.h>
using namespace std;
const int maxa = 1e6 + 10;
long long int a[maxa], s[maxa];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  for (int i = 1; i < maxa; i++) s[i] = s[i - 1] + a[i];
  for (int i = maxa; i > k; i--) {
    long long int sum = 0;
    for (int j = i; j < maxa; j += i) sum += s[min(maxa - 1, j + k)] - s[j - 1];
    if (sum == n) {
      cout << i << endl;
      return 0;
    }
  }
  for (int i = 0; i < maxa; i++)
    if (a[i]) {
      cout << i << endl;
      return 0;
    }
  return 0;
}
