#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e6 + 10;
int cf[maxn];
int sum[maxn];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int maxv = 0;
  int minv = 0x3f3f3f3f;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    cf[x]++;
    maxv = max(maxv, x);
    minv = min(minv, x);
  }
  for (int i = 1; i <= maxv; i++) {
    cf[i] += cf[i - 1];
  }
  int ans = 0;
  if (m + 1 >= minv) {
    ans = minv;
  } else {
    int all = 0;
    for (int i = m + 1; i <= minv; i++) {
      all = 0;
      for (int d = 1; d * i <= maxv; d++) {
        all += cf[min(maxv, d * i + m)] - cf[min(d * i - 1, maxv)];
      }
      if (all == n) ans = i;
    }
  }
  cout << ans << endl;
}
