#include<bits/stdc++.h>
using namespace std;
int n,q;
long long dan;
long long p[300010];
long long d[300010];
long long k[300010];
long long prip[300010];
long long kup[300010];
int main()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++){
        cin>>d[i]>>p[i];
        kup[i]=kup[i-1]+p[i];
        if(prip[i-1]>=d[i]-d[i-1])prip[i]=prip[i-1]+p[i]-d[i]+d[i-1];
        else{
            prip[i]=p[i];
        }
    }

    for(int i=1;i<=q;i++){
        dan=0;
        cin>>k[i];
        if(k[i]<d[1]){
            cout<<0<<endl;
            continue;
        }
        for(int j=1;j<=n;j++){
            if(d[j]>k[i]){
                dan=j;
                break;
            }
        }
        if(dan==0){
            
            if(prip[n]>k[n]-d[n])cout<<1+kup[n]-prip[n]+k[i]-d[n]<<endl;
            else cout<<kup[n]<<endl;
        }else{
            if(k[i]-d[dan-1]>prip[dan-1])cout<<kup[dan-1]<<endl;
            else cout<<kup[dan-1]-prip[dan-1]+k[i]-d[dan-1]+1<<endl;
            
        }
        
    }
        return 0;
    }