#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
int n, k;
int sum[maxn], mn = inf, mx;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    mn = min(mn, x);
    mx = max(mx, x);
    sum[x]++;
  }
  for (int i = 1; i <= mx; i++) sum[i] += sum[i - 1];
  int ans = 1;
  for (int i = mn; i >= 2; i--) {
    int tot = 0;
    for (int j = i; j <= mx; j += i) {
      if (j + k > mx)
        tot += sum[mx] - sum[j - 1];
      else
        tot += sum[j + k] - sum[j - 1];
    }
    if (tot >= n) {
      ans = i;
      break;
    }
  }
  cout << ans << "\n";
  return 0;
}
