#include <bits/stdc++.h>
using namespace std;
int n, k;
long long arr[(int)3e5 + 5];
bool solve(int num) {
  for (int i = num; i < 1e6; i += num) {
    int l = 0, r = n - 1, mid, ans = -1;
    while (l <= r) {
      mid = (l + r) / 2;
      if (arr[mid] >= i && arr[mid] < i + num)
        ans = arr[mid], l = mid + 1;
      else if (arr[mid] >= i)
        r = mid - 1;
      else
        l = mid + 1;
    }
    if (ans != -1 && ans % num > k) return false;
  }
  return true;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  for (int i = arr[0]; i >= 1; i--)
    if (solve(i)) return cout << i, 0;
  cout << 1;
  return 0;
}
