#include <bits/stdc++.h>
using namespace std;
const int MAX = 3 * 100000 + 10;
int s[MAX];
int main() {
  int n, k;
  while (cin >> n >> k) {
    int gcd = 99999999, temp;
    for (int i = 0; i < n; ++i) {
      scanf("%d", &s[i]);
      gcd = min(gcd, s[i]);
    }
    while (true) {
      temp = gcd;
      for (int i = 0; i < n; ++i) {
        int num = s[i] / gcd;
        if (num > 0 && s[i] - num * gcd <= k) continue;
        gcd = s[i] / (num + 1);
      }
      if (gcd == temp) break;
    }
    cout << gcd << endl;
  }
  return 0;
}
