#include <bits/stdc++.h>
using namespace std;
const double eps = 1.0e-9;
const unsigned long long MAX_N = 300001;
const unsigned long long MAX_M = 1000001;
int vals[MAX_N];
int main(int argc, char** argv) {
  std::ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int max_val, min_val;
  min_val = MAX_M;
  max_val = 0;
  for (unsigned int i = 0; i < (unsigned long long)(n); ++i) {
    cin >> vals[i];
  }
  sort(vals, vals + n);
  int i, mod = vals[0];
  while (true) {
    for (i = 0; i < n; i++) {
      if (vals[i] % mod > k) {
        mod = vals[i] / (vals[i] / mod + 1);
        break;
      }
    }
    if (i == n) {
      cout << mod << endl;
      break;
    }
  }
  return 0;
}
