#include <bits/stdc++.h>
using namespace std;
const int LM = 3e5, MX = 1e6;
int n, k, x = 1e9;
int a[LM + 2], f[MX + 2];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    x = min(a[i], x);
    f[a[i]]++;
  }
  for (int i = 1; i <= MX; i++) {
    f[i] += f[i - 1];
  }
  for (int i = x; i >= 1; i--) {
    int c = 0;
    if (k >= i) {
      c = n;
    } else {
      for (int q = 1; q * i <= MX; q++) {
        c += f[min(q * i + k, MX)] - f[q * i - 1];
      }
    }
    if (c == n) {
      cout << i << endl;
      return 0;
    }
  }
}
