// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

#define int long long int

#define vi vector<int>

#define ff first
#define ss second

#define pb push_back
#define MOD 1000000007
//const int nax = 1e6+5;
#define inf 4e18
#define Graph vector<vi>
#define Graphw vector<vector<pair<int,int>>> 
#define sz(x) (int)x.size()
#define pr pair<int,int>

#define display(v) for(int i =0;i<(int)v.size();++i)cout << v[i] << " "
#define all(v) v.begin(),v.end()
#define read(a) for(int i = 0;i<(int)a.size();++i)cin>>a[i]
#define show(x) cout << #x << " is " << x << "\n";
// typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_si;
// typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_msi;
#define show_arr(a) cout << #a << "\n"; display(a) ; cout << "\n";
inline int add(int a, int b){ int c = (a%MOD) + (b%MOD); if(c >= MOD) c -= MOD; return c; }
inline int mul(int a, int b){ return ((a%MOD) * 1ll * (b%MOD)) % MOD; }
inline int sub(int a, int b){ int c = (a%MOD) - (b%MOD); if(c < 0) c += MOD; return c; }
inline int sum_till(int n) { return mul(mul(n, n + 1), (MOD + 1) / 2); }
const int nax = 300*1000 + 10;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//#define ook order_of_key
//#define fbo find_by_order
//   order_of_key(x) -> number of elements less than x.
// * find_by_order(x) -> gives the element at index x (0 - indexing)

void test_case();
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1; //cin>>t;
    while(t--){
        test_case();
    }
    return 0;
}

void test_case(){
    int n, q; cin>>n>>q;
    vi a(n); read(a);
    vi b(n); b[0] = a[0] - 1;
    for(int i = 1 ; i < n ; ++i){
        b[i] = a[i] - a[i - 1] - 1;
        b[i] += b[i - 1];
    }
    // show_arr(b);
    while(q--){
        int k; cin>>k;
        int id = lower_bound(all(b), k) - b.begin();
        int offset = (id - 1 >= 0)?a[id - 1]:0;
        int lst = (id - 1 >= 0)?b[id - 1]:0;
        cout << offset + (k - lst) << '\n';
    }

}    

// Химаншу
// check overflow
// special case n == 1
// 🍪🍪🍪
    

    
#include<iostream>
#include<map>
#include<vector>
using namespace std;
typedef long long li;
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

struct modint{
  li num;

  modint(li a=0){
    num=(a%MOD+MOD)%MOD;
  }
  modint operator+(modint a) {return{(num+a.num)%MOD};} 
  modint operator-(modint a) {return{((num-a.num)%MOD+MOD)%MOD};}
  modint operator*(modint a) {return{num*a.num%MOD};}
  modint& operator+=(modint a) {
    (num += a.num)%=MOD;
    return *this;
  }
  modint& operator-=(modint a) {
    (num += MOD-a.num)%=MOD;
    return *this;
  }
  modint& operator*=(modint a) {
    (num*=a.num)%=MOD;
    return *this;
  }
};

std::ostream& operator<<(std::ostream& os, const modint& m){
  // ここでストリームに obj を書き込みます。
  li a=m.num;
  a%=MOD;
  a+=MOD;
  a%=MOD;
  cout << a;
  return os;
}

std::istream& operator>>(std::istream& os,modint& m){
  // ここでストリームに obj を書き込みます。
  li a; cin >>a;
  m=a;
  return os;
}

modint modpow(modint a,long int r){
  modint b=a,ans=1;
  while(r){
    if(r%2) ans*=b;
    b*=b;
    r/=2;
  }
  return ans;
}

// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
};

struct node{
  int v;
  li w;
  node(int a, li b=1){v=a, w=b;;}
};

struct graph{
  int n,rho;
  int m;
  int weighted,origin,directed;
  li ma;

  vector<vector<node>> adj;
  vector<li> col,w;
  vector<int> uf;
  int find(int v){ return (uf[v]<0)?v:uf[v]=find(uf[v]); }
  int unite(int a,int b){
    a=find(a); b=find(b);
    if(a==b) return 0;
    rho--;
    if(a>b) swap(a,b);
    uf[a]+=uf[b];
    uf[b]=a;
    return 1;
  }
  int size(int a){ return -uf[find(a)];} 
  graph(int nn,int mm,int d_flag=0,int w_flag=0,int ori=1){
    ma=0;
    n=nn; m=mm;
    weighted=w_flag;
    directed=d_flag;
    origin=ori;
    if(df){
      print(origin,"-origin");
      if(weighted) print("weighted");
      if(directed) print("directed");
    }
    adj.resize(n);
    uf.resize(n,-1);
    rho=n;
    rep(i,m){
      int a,b; li w=1; cin >>a >>b; a-=origin; b-=origin;
      if(weighted) cin >>w;
      //      if(df)print(w);
      adj[a].push_back({b,w});
      if(not directed)
        adj[b].push_back({a,w});
      unite(a,b);
      ma=max(ma,w);
    }
  }
  void add(int a,int b,li w=1){
      adj[a].push_back({b,w});
      if(not directed)
        adj[b].push_back({a,w});
      ma=max(ma,w);
      unite(a,b);
  }

  li dijkstra(int a,int b);
  li dijkstra(int b=-1){
    if(b==-1) b=n-1;
    return dijkstra(0,b);
  };

};

std::ostream& operator<<(std::ostream& os,const node& n){
  printf("%d[%ld]",n.v,n.w);
  return os;
};

std::ostream& operator<<(std::ostream& os,const graph& g){
  if(g.weighted){
    rep(i,g.n){
      printf("%d :",i+g.origin);
      for(auto p:g.adj[i]){
        printf(" %d[%ld]",p.v+g.origin,p.w);
      }
      print("");
    }
  }else{
    rep(i,g.n){
      printf("%d :",i+g.origin);
      for(auto p:g.adj[i]){
        printf(" %d",p.v+g.origin);
      }
      print("");
    }
  }
  return os;
};


void dfs(graph& g,vector<li>& cs,int a=0,int p=-1){
  for(auto x:g.adj[a]){
    if(x.v==p) continue;
    cs[x.v]=cs[a]^x.w;
    dfs(g,cs,x.v,a);
  }
}

int main(){
  int n; cin >>n;
  graph g(n,n-1,0,1);
  if(df)print(g);
  vector<li> cs(n,0);
  dfs(g,cs);
  if(df)print(cs);
  
  li b=1;
  modint ans=0;
  rep(i,60){
    modint one,zero;
    rep(t,n){
      ((b&cs[t])?one:zero)+=1;
    }
    if(df)print(one,zero,b);
    ans+=one*zero*b;
    b*=2;
  }
  print(ans);
}
