#include <bits/stdc++.h>
using namespace std;
const long long inf = 1LL << 28;
const long long mod = 1LL;
int arr[3 * 100010];
int main() {
  int n, k, i, ans, flag, j;
  while (scanf("%d %d", &n, &k) == 2) {
    for (i = 0; i < n; i++) {
      scanf("%d", &arr[i]);
    }
    sort(arr, arr + n);
    ans = arr[0];
    while (true) {
      flag = true;
      for (i = 0; i < n; i++) {
        if (arr[i] % ans <= k) continue;
        flag = false;
        j = arr[i] / ans;
        j++;
        ans = arr[i] / j;
      }
      if (flag) break;
    }
    printf("%d\n", ans);
  }
  return 0;
}
