#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int n,q;cin>>n>>q;

    vector<long long>d(n),p(n);
    for(int i=0;i<n;i++){cin>>d[i]>>p[i];}

    vector<long long>plazme(n);
    for(int i=0;i<n-1;i++){
        if(p[i]<=d[i+1]-d[i]){
            plazme[i+1]=plazme[i]+p[i];
        }
        else{
            plazme[i+1]=plazme[i]+(d[i+1]-d[i]);
            p[i+1]+=p[i]-(d[i+1]-d[i]);
        }
    }

    for(int i=0;i<q;i++){
        long long broj, pojela=0;cin>>broj;

        int b=upper_bound(d.begin(),d.end(),broj)-d.begin();
        b--;

        if(b<0){cout<<"0\n";continue;}
        pojela=plazme[b];

        pojela+=min(p[b],broj+1LL-d[b]);
        cout<<pojela<<"\n";
    }
    return 0;
}