#include <bits/stdc++.h>
#define ll long long
using namespace std;
int N, Q;
ll p[300005], d[300005], px, sum, miss, j = 1;
int main(){
    scanf("%d %d", &N, &Q);
    for(int i = 1; i <= N; i++)scanf("%lld %lld", &d[i], &p[i]);
    for(int i = 1; i <= Q; i++){
        ll x;
        scanf("%lld", &x);
        while(d[j] <= x && j <= N){
            sum += p[j];
            if(j == 1)miss = d[j] - 1;
            else
            miss += max(0LL, d[j] - d[j - 1]  - px);
//            cout << "j: " << j << '\n' << "miss: " << miss << '\n' << "ostalo od prethodnog: " << px << endl;
            px = max(0LL, px - d[j] + d[j - 1]) + p[j];
            j++;
        }
        cout << min(x - miss, sum) <<  endl;

    }
return 0;
}