#include <bits/stdc++.h>
using namespace std;
int dp[5000010];
vector<int> v;
int main() {
  int i, j, k, d, n, cnt, flag, tot, ans = 0;
  scanf("%d%d", &n, &k);
  for (i = 0; i <= 5000000; i++) dp[i] = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &j);
    v.push_back(j);
    dp[j] += 1;
  }
  sort(v.begin(), v.end());
  for (i = 1; i <= 5000000; i++) dp[i] += dp[i - 1];
  if (v[0] <= k + 1)
    printf("%d\n", v[0]);
  else {
    for (d = v[0]; d > k; d--) {
      j = 1;
      cnt = 0;
      tot = 0;
      flag = 0;
      while (j * d <= v[n - 1]) {
        cnt = dp[j * d + k] - dp[j * d - 1];
        tot += cnt;
        j += 1;
      }
      if (tot == n) {
        flag = 1;
        break;
      }
    }
    printf("%d\n", d);
  }
  return 0;
}
