#include <bits/stdc++.h>
using namespace std;
int n, k, a[2100010];
int MAX, MIN = 100000000;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    int tmp;
    scanf("%d", &tmp);
    MAX = max(MAX, tmp);
    MIN = min(MIN, tmp);
    a[tmp]++;
  }
  for (int i = 1; i <= MAX + k; ++i) {
    a[i] += a[i - 1];
  }
  for (int i = MIN; i; --i) {
    int sum = 0;
    if (k < i)
      for (int d = i; d <= MAX; d += i) {
        sum += a[d + k] - a[d - 1];
      }
    if (sum == n || k >= i) {
      printf("%d", i);
      return 0;
    }
  }
}
