#include <bits/stdc++.h>
using namespace std;
int a[300010];
int b[4000010];
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  int minx = 1e6, maxx = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    minx = min(minx, a[i]);
    maxx = max(maxx, a[i]);
    b[a[i]]++;
  }
  for (int i = 1; i <= 4 * maxx; i++) b[i] += b[i - 1];
  if (minx <= k) {
    printf("%d\n", minx);
    return 0;
  }
  for (int i = minx; i > k; i--) {
    int tmp = 0;
    int t = maxx / i;
    for (int j = 1; j <= t + 1; j++) tmp = tmp + b[i * j + k] - b[i * j - 1];
    if (tmp == n) {
      printf("%d\n", i);
      return 0;
    }
  }
}
