#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  int MIN = 1e9;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    MIN = min(MIN, A[i]);
  }
  if (MIN <= k + 1) {
    cout << MIN << endl;
    return 0;
  }
  sort(A.begin(), A.end());
  for (int d = MIN; d > k + 1; d--) {
    int lim = A[A.size() - 1] / d;
    int terms = 0;
    for (int i = 1; i <= lim; i++) {
      int l = i * d;
      int r = l + k;
      terms += (upper_bound(A.begin(), A.end(), r) -
                lower_bound(A.begin(), A.end(), l));
    }
    if (terms == n) {
      cout << d << endl;
      return 0;
    }
  }
  cout << k + 1 << endl;
  return 0;
}
