#include <bits/stdc++.h>
#define maxn 1000050
#define maxq 1000050
int n,q;
long long p[maxn], d[maxq], k[maxq];
using namespace std;
int main(){
    cin >>n>>q;
    for (int i =1;i<=n;i++){
        cin >>d[i]>>p[i];
    }
    for (int j =1; j <=q; j ++){
        cin >>k[j];
    }
    while (q--){
        int br =0;
        for (int i =1; i<=n; i++){
        if (d[i] < k[i]){
        if (p[i] >= (d[i+1] -d[i])) br += d[i+1]-d[i]+1;
        else br += p[i];
        }
        else if (d[i] ==k[i]) br ++;
    }
    cout<<br<<endl; 
    }
}