#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> vec(n);
  for (auto &x : vec) cin >> x;
  sort(vec.begin(), vec.end());
  int ans = 1;
  for (int i = 2; i <= vec[0]; i++) {
    bool good = true;
    for (int j = i; j < 1e6; j += i) {
      int st = 0, en = n - 1, mid, ans = -1;
      while (st <= en) {
        int mid = (st + en) / 2;
        if (vec[mid] >= j && vec[mid] < j + i) {
          ans = vec[mid];
          st = mid + 1;
        } else if (vec[mid] < j) {
          st = mid + 1;
        } else {
          en = mid - 1;
        }
      }
      if (ans != -1 && ans % i > k) {
        good = false;
        break;
      }
    }
    if (good) ans = i;
  }
  cout << ans;
  return 0;
}
