#include <bits/stdc++.h>

using namespace std;

int main()
{
    unsigned int n,q,i,j,m,plz;
    long long dan,k,res;
    vector<int>p;
    vector<long long>d,r;
    cin>>n>>q;
    for(i=0;i<n;i++){
        cin>>dan>>plz;
        d.push_back(dan);
        p.push_back(plz);
    }
    for(j=0;j<q;j++){
        cin>>k;
        plz=0;
        i=0;
        d.push_back(k+1);
        m=distance(d.begin(),upper_bound(d.begin(),d.end(),k));
        if(m>n)m=n;
        d.insert(d.begin()+m,k+1);
        p.insert(p.begin()+m,0);
        m++;
        r.push_back(0);
        //for(i=0;i<=n;i++)
        //    cout<<d[i]<<" "<<p[i]<<endl;

        for(i=0;i<m-1;i++){
            plz+=p[i];
            if(plz>d[i+1]-d[i])
                res=d[i+1]-d[i];
            else
                res=plz;
            //cout<<i<<" "<<m<<" "<<d[i+1]-d[i]<<endl;
            r[j]+=res;
            plz-=res;
        }
        d.erase(d.begin()+m-1);
        p.erase(p.begin()+m-1);
    }
    for(j=0;j<q;j++)
        cout<<r[j]<<endl;
    return 0;
}