#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
int main(){
    int n,q;scanf("%i%i",&n,&q);
    ll a[n+10],b[n+10];for(int i=1;i<=n;i++) scanf("%lld%lld",&a[i],&b[i]);
    ll num=0,sum=0;a[0]=b[0]=0;
    for(int j=1,i=0;j<=q;j++){
		ll K;scanf("%lld",&K);
		while(i<n&&a[i+1]<=K){
			num=max(0LL,num-(a[i+1]-a[i]));
			num+=b[i+1];
			sum+=b[i+1];
			i++;
		}
		//printf("%i %lld %lld\n",i,num,sum);
		ll num1=max(0LL,num-(K-a[i]+1));
		printf("%lld\n",sum-num1);
    }
    return 0;
}