#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a, ll b){
	return b?gcd(b,a%b):a;
}
ll a[200005],b[200005],c,d;
int main(){
	ll n,m;
	scanf("%lld%lld",&n,&m);
	ll d=0;
	cin>>a[1];
	for(ll i=2;i<=n;i++){		    //从a[2]-a[1]开始 
		scanf("%lld",&a[i]);
		d=gcd(d,a[i]-a[i-1]);		//gcd(0,a)=a
	}
	for(ll i=1;i<=m;i++){
		scanf("%lld",&b[i]);
		ll dd=abs(gcd(d,a[1]+b[i]));
		printf("%lld ",dd);
	}
	return 0;
}