#include <bits/stdc++.h>
using namespace std;
const int Maxn = 300 * 1000 + 5;
int n, k, arr[Maxn];
int main() {
  scanf("%d%d", &n, &k);
  int Min = INT_MAX, Max = 0;
  for (int i = 0; i < n; i++)
    scanf("%d", &arr[i]), Min = min(Min, arr[i]), Max = max(Max, arr[i]);
  sort(arr, arr + n);
  for (int i = Min; i > 0; i--) {
    bool mark = false;
    if (Max % i <= k) {
      for (int j = 2; j * i <= Max; j++) {
        int ind = lower_bound(arr, arr + n, i * j) - arr;
        ind--;
        if (ind >= 0) {
          if (arr[ind] % i > k) mark = true;
        }
      }
      if (!mark) {
        printf("%d\n", i);
        return 0;
      }
    }
  }
  return 0;
}
