#include <bits/stdc++.h>
using namespace std;
int a[300005];
int n, k;
int findl(int x) {
  int l = 0, h = n;
  while (l < h) {
    int m = (l + h) / 2;
    if (a[m] >= x) {
      h = m;
    } else
      l = m + 1;
  }
  return h;
}
int findh(int x) {
  int l = 0, h = n;
  int ans = -1;
  while (l < h) {
    int m = (l + h) / 2;
    if (a[m] <= x) {
      l = m + 1;
      ans = m;
    } else
      h = m;
  }
  return ans;
}
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    int i;
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    sort(a, a + n);
    if (a[0] <= k + 1)
      printf("%d", a[0]);
    else {
      int ans = k + 1;
      for (i = k + 1; i <= a[0]; i++) {
        int ss = 0;
        for (int j = 0; j <= a[n - 1] / i; j++) {
          int x = findl(i * j);
          int y = findh(i * j + k);
          if (x <= y) ss += y - x + 1;
        }
        if (ss == n) ans = i;
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}
