#include <bits/stdc++.h>
using namespace std;
vector<int> Numbers;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    Numbers.push_back(temp);
  }
  sort(Numbers.begin(), Numbers.end());
  if (k + 1 >= Numbers[0]) {
    cout << Numbers[0] << "\n";
    return 0;
  }
  int MAXGCD = INT_MIN;
  for (int i = k + 1; i <= Numbers[0]; i++) {
    int Lim = Numbers.back() / i;
    for (int j = 1; j <= Lim; j++) {
      int TT =
          lower_bound(Numbers.begin(), Numbers.end(), i * j) - Numbers.begin();
      if (TT != 0) {
        if (Numbers[TT - 1] % i > k) break;
      }
      if (j == Lim && Numbers.back() % i <= k) MAXGCD = max(MAXGCD, i);
    }
  }
  cout << MAXGCD << "\n";
  return 0;
}
