#include<bits/stdc++.h>
using namespace std;
#define ll long long 

ll int gcd(ll int a,ll  int b){
    if(b==0) return a;
    if(a==0) return b;
    else return gcd(b,a%b);
}

int main(){
    int n1,n2;cin >> n1 >> n2 ;
    ll int a[n1],b[n2];
    ll int gd;
    for(int i=0;i<n1;i++){
        cin >> a[i];
    }
    for(int i=0;i<n2;i++){
        cin >> b[i];
    }
    if(n1==1){
        for(int i=0;i<n2;i++){
            cout << a[0] + b[i] << " ";
        }
        return 0;
    }
    gd=abs(a[0]-a[1]);
    for(int i=1;i<n1-1;i++){
        gd=gcd(gd,abs(a[i+1]-a[i]));
    }
    for(int i=0;i<n2;i++){
        cout << gcd(gd,(a[0]+b[i]))<<  " ";
    }
    cout << endl;

}