#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, in, gr = 0;
  int vet[300000];
  cin >> n >> k;
  for (int j = 0; j < n; j++) {
    cin >> in;
    vet[j] = in;
  }
  sort(vet, vet + n);
  for (int i = vet[0]; i > 0; i--) {
    bool limitk = true;
    for (int it = 0; it < n; it++) {
      if (vet[it] % i <= k) {
        limitk = limitk && true;
      } else {
        while (vet[it] % i > k) {
          i--;
        }
        i++;
        limitk = false;
        break;
      }
    }
    if (limitk) {
      gr = i;
      break;
    }
  }
  cout << gr;
  return 0;
}
