#include <bits/stdc++.h>
using namespace std;
int ans[300009];
int a[300009];
int b[2000009];
void update(int x, int num) {
  while (x <= 1000001) {
    b[x] += num;
    x += x & -x;
  }
}
int getsum(int x) {
  int sum = 0;
  while (x > 0) {
    sum += b[x];
    x -= x & -x;
  }
  return sum;
}
int main() {
  int n, k, ma = 1;
  scanf("%d%d", &n, &k);
  int x = 1 << 30;
  for (int i = 0; i < n; i++) {
    int y;
    scanf("%d", &y);
    update(y, 1);
    x = min(x, y);
    ma = max(ma, y);
  }
  if (x <= k)
    printf("%d\n", x);
  else {
    for (int i = x; i >= k + 1; i--) {
      int t = 0;
      bool ok = 1;
      while (t * i + k + 1 < x) t++;
      while (t * i + k + 1 <= ma) {
        int lim = min(t * i + i - 1, ma);
        int sum = getsum(lim) - getsum(t * i + k);
        if (sum) {
          ok = 0;
          break;
        }
        t++;
      }
      if (ok) {
        printf("%d\n", i);
        return 0;
      }
    }
    printf("%d\n", k);
  }
}
