#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,q;
    cin>>n>>q;
    int* p=new int[n];
    long long* d=new long long[n];
    int i,j;
    for(i=0;i<n;i++){
        cin>>d[i];
        cin>>p[i];
    }
    long long* k=new long long[q];
    for(i=0;i<q;i++){
        cin>>k[i];
    }
    i=1,j=0;
    long long plazmica=(long long)p[0];
    long long poruckala=0;
    while(j<q && k[j]<d[0]){
        cout<<"0"<<endl;
        j++;
    }
    while(i<n && j<q){
        while(i<n && d[i]<=k[j]){//
            if(((long long)d[i]-d[i-1])>(long long)plazmica){
                poruckala+=(long long)plazmica;
                plazmica=0ll;
            }
            else{
                poruckala+=((long long)d[i]-d[i-1]);
                plazmica-=((long long)d[i]-d[i-1]);
            }
            plazmica+=(long long)p[i];
            i++;
        }
        if(((long long)k[j]-d[i-1]+1ll)>(long long)plazmica){
            poruckala+=(long long)plazmica;
            plazmica=0ll;
        }
        else{
            poruckala+=((long long)k[j]-d[i-1]+1ll);
            plazmica-=((long long)k[j]-d[i-1]+1ll);
        }
        cout<<poruckala<<endl;
        j++;
        while(i<n && j<q && k[j]<d[i]){
            if(((long long)k[j]-k[j-1])>(long long)plazmica){
                poruckala+=(long long)plazmica;
                plazmica=0ll;
            }
            else{
                poruckala+=((long long)k[j]-k[j-1]);
                plazmica-=((long long)k[j]-k[j-1]);
            }
            cout<<poruckala<<endl;
            j++;
        }
        if(i<n && j<q){
            if(((long long)d[i]-k[j-1]-1ll)>(long long)plazmica){
                poruckala+=(long long)plazmica;
                plazmica=0ll;
            }
            else{
                poruckala+=((long long)d[i]-k[j-1]-1ll);
                plazmica-=((long long)d[i]-k[j-1]-1ll);
            }
            plazmica+=(long long)p[i];
            i++;
            if(i==n){
                k[j-1]=(long long)d[i-1]-1;
            }
        }
    }
    while(j<q){
        if(((long long)k[j]-k[j-1])>(long long)plazmica){
            poruckala+=(long long)plazmica;
            plazmica=0ll;
        }
        else{
            poruckala+=((long long)k[j]-k[j-1]);
            plazmica-=((long long)k[j]-k[j-1]);
        }
        cout<<poruckala<<endl;
        j++;
    }
    delete[] p;
    delete[] k;
    delete[] d;
    return 0;
}