#include <bits/stdc++.h>
using namespace std;
const int MAX = 5e5 + 7;
int a[MAX], n, k;
int f[MAX * 10];
const int LIMIT = 1e6;
int func() {
  int mini = *min_element(a + 1, a + 1 + n);
  if (mini <= k + 1) return mini;
  for (int i = 1; i <= LIMIT; i++) f[i] = f[i - 1] + f[i];
  for (int d = mini; d >= k + 1; d--) {
    int c = 0;
    for (int j = 1; j * d <= LIMIT; j++) {
      int l = j * d;
      int r = l + k;
      r = min(r, LIMIT);
      c += f[r] - f[l - 1];
    }
    if (c == n) return d;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    f[a[i]]++;
  }
  cout << func() << endl;
  return 0;
}
