#include <cstdlib>
#include <iostream>
#include <cstdio>
#include <math.h>
#include <cstring>
#include <time.h>
#include <complex>
#include <algorithm>
#include <queue>
#include <unordered_map>
#include <set>
#include <bitset>

#pragma warning(disable:4996)
#define PII std::pair<long long, long long>
#define PTT std::pair<tree *, tree *>

template<typename T> T min(T x, T y)
{
	return x < y ? x : y;
}
template<typename T> T max(T x, T y)
{
	return x > y ? x : y;
};

const long long INF = 200000000500000;//;// autojs.org
const long long mod = 100000007;// 1000000007;// 998244353;//
const long long MAXN = 200005;

int N, M;
long long a[MAXN], b[MAXN];

long long mabs(long long x) { return x > 0 ? x : -x; }
long long gcd(long long x, long long y)
{
	return !y ? x : gcd(y, x % y);
}

int main()
{
	scanf("%d %d", &N, &M);
	for (int i = 1; i <= N; i++)
		scanf("%lld", a + i);
	for (int i = 1; i <= M; i++)
		scanf("%lld", b + i);

	long long t = 0;
	for (int i = 2; i <= N; i++)
		t = gcd(t, mabs(a[i] - a[1]));
	for (int i = 1; i <= M; i++)
		printf("%lld ", gcd(t, a[1] + b[i]));

	return 0;
}