#include <bits/stdc++.h>
#define maxn 1000050
#define maxq 1000050
int n,q;
long long p[maxn], d[maxn], k[maxq];
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    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 j =1; j<=n; j++){
        if (j!=n){
            if (d[j]<k[q]){
                if (p[j]>(d[j+1]- d[j])) br += d[j+1]-d[j]+1;
                else br+=p[j];
            }
        }
        else if (d[j]<=k[q]){
            if (p[j]>(k[q] -d[j]))br += k[q]- d[j]+1;
            else if ((p[j]- k[q])<= p[j])br += p[j];
        }
        
        }
        q--;
        cout<<br<<endl;
    }
    
}