#include <bits/stdc++.h>
using namespace std;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
inline int addmod(int x, int y) {
  return (x % 1000000007 + y % 1000000007) % 1000000007;
}
inline int submod(int x, int y) {
  return (x % 1000000007 - y % 1000000007 + 1000000007) % 1000000007;
}
inline int mulmod(int x, int y) {
  return (x % 1000000007 * 1LL * y % 1000000007) % 1000000007;
}
inline int nextSubMask(int i, int mask) { return (i - 1) & mask; }
void we_r_done() {
  cout << "NO";
  exit(0);
}
void debug(bool ok, string mssg) {
  if (ok) return;
  cout << mssg;
  exit(0);
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int mn = 1e9, mx = -1;
  int a[n + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    mn = min(mn, a[i]);
    mx = max(mx, a[i]);
  }
  vector<int> cnt(mx + 4, 0);
  for (int i = 1; i <= n; i++) cnt[a[i]]++;
  for (int i = 1; i <= mx; i++) cnt[i] += cnt[i - 1];
  for (int d = mn; d > k; d--) {
    int tot = 0;
    for (int lo = d; lo <= mx; lo += d) {
      int hi = min(mx, lo + k);
      tot += (cnt[hi] - cnt[lo - 1]);
    }
    if (tot == n) {
      cout << d;
      return 0;
    }
  }
  cout << mn;
  return 0;
}
