#include <bits/stdc++.h>
#define endl '\n'
#define int long long

using namespace std;

const int MAXN = 300010;

int n,q;
int dan[MAXN],kol[MAXN],pref[MAXN];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,q;
    cin>>n>>q;
    for(int i=1;i<=n;i++)cin>>dan[i]>>kol[i];
    for(int i=1;i<=n;i++)pref[i]=pref[i-1]+kol[i];
    while(q--){
        int x;
        cin>>x;
        int ind=(upper_bound(dan+1,dan+n+1,x)-dan)-1;
        int res=pref[ind-1];
        res+=min(kol[ind],x-dan[ind]+1);
        cout<<res<<endl;
    }
    return 0;
}