#include <bits/stdc++.h>
using namespace std;
int n, k, a[300000];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  if (k >= a[0]) {
    cout << a[0] << endl;
    return 0;
  }
  n = unique(a, a + n) - a;
  for (int g = a[0]; g >= k; g--) {
    int m = 0;
    for (int i = 0; g * i <= 1e6 + 1; i++)
      m += (upper_bound(a, a + n, g * i + k) - lower_bound(a, a + n, g * i));
    if (m == n) {
      cout << g << endl;
      return 0;
    }
  }
}
