#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,q;
    cin >> n >> q;
    vector<ll>d(n),p(n,0),res(n);
    
    for(int i = 0; i < n; i++){
        long long dx, px;
        cin >> dx >> px;
        d[i] = dx;
        p[i] = px;
        
        
        
    }
    for(int i = 0; i < n; i++){
        if(d[i+1]-d[i]+1 < p[i] and i<n-1){
             p[i+1] += p[i]-(d[i+1]-d[i]);
             p[i] =d[i+1]-d[i];}
        if(i== 0)
            res[i] = p[i];
        else
            res[i] = p[i]+res[i-1];
        
        
    }
    for(int i = 0; i < q; i++){
        long long upit;
        cin >> upit;
        auto poz = upper_bound(d.begin(),d.end(),upit)-d.begin()-1;
        if(upit == d[0]) int poz = 0;
        if(poz == -1) cout << 0 <<'\n';
        else{
            long long resenje;
            if(poz == 0)
                resenje = min(upit-d[poz]+1,p[poz]);
            else{
                if(upit < d[n-1]+p[n-1]){
                    resenje = min(res[poz],res[poz-1]+upit-d[poz]+1);}
                else{
                    resenje = res[poz];}}
            cout << resenje << '\n';
        
        

    }}
    return 0;
}