#include <bits/stdc++.h>
int dr[] = {2, 2, -2, -2, 1, -1, 1, -1};
int dc[] = {1, -1, 1, -1, 2, 2, -2, -2};
int dr1[] = {0, 0, 0, 1, 1, 1, -1, -1, -1};
int dc1[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
int dr2[] = {0, 0, 1, -1};
int dc2[] = {1, -1, 0, 0};
using namespace std;
long long int fr[2000004];
int main() {
  long long int n, i, x, j, k;
  while (cin >> n >> k) {
    memset(fr, 0, sizeof(fr));
    for (long long int i = 1; i < n + 1; i++) {
      scanf("%lld", &x);
      fr[x]++;
    }
    for (long long int i = 1; i < 2000004; i++) fr[i] += fr[i - 1];
    long long int ans = 1;
    for (i = 1000000; i >= 1; i--) {
      long long int r = min(i - 1, k);
      long long int s = 0;
      for (j = 1; j * i <= 1000000; j++) {
        long long int p = fr[(i * j) + r] - fr[(i * j) - 1];
        s += p;
      }
      if (s == n) {
        ans = i;
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
