#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000000 + 20;
int used[MAX_N];
int a[MAX_N];
int n, k;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k;
  for (int i(0); i < int(n); i++) {
    int x;
    cin >> x;
    ++used[x];
  }
  int sum = 0;
  for (int i = 0; i <= 1000000; i++) {
    a[i] = sum;
    sum += used[i];
  }
  int ans = 0;
  for (int i = 1; i <= 1000000; i++) {
    int res = 0, p = min(k, i - 1);
    for (int j = i; j < 1000001; j += i) {
      int y = min(1000000, j + p);
      res += a[y] - a[j] + used[y];
    }
    if (res == n) ans = max(ans, i);
  }
  cout << ans << endl;
  return 0;
}
