#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 * 3 + 10;
int num[maxn];
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    for (int i = 0; i < n; ++i) scanf("%d", &num[i]);
    sort(num, num + n);
    int ans = num[0];
    int j;
    while (true) {
      for (j = 0; j < n; ++j) {
        if (num[j] % ans > k) {
          ans = num[j] / (num[j] / ans + 1);
          break;
        }
      }
      if (j == n) break;
    }
    printf("%d\n", ans);
  }
  return 0;
}
