#include <bits/stdc++.h>
using namespace std;
int num[300010], n, k;
int main() {
  while (scanf("%d %d", &n, &k) != EOF) {
    int min = 1000000;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &num[i]);
      if (min > num[i]) min = num[i];
    }
    while (1) {
      int i, tmp = min;
      for (i = 1; i <= n; i++) {
        if (num[i] % min > k) {
          min = num[i] / (num[i] / min + 1);
        }
      }
      if (min == tmp) break;
    }
    printf("%d\n", min);
  }
  return 0;
}
