#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n, q;
    cin >> n >> q;
    long long d[n+1], p[n+1], pojedeni[n+1], zalihe[n+1];
    pojedeni[0]=0;
    zalihe[0]=0;
    d[0]=0;
    for(int i = 1; i<n+1; i++){
        cin >> d[i];
        cin >> p[i];
        pojedeni[i]=pojedeni[i-1]+1+min(zalihe[i-1], d[i] - d[i-1]);
        zalihe[i]=p[i]-1+ max<long long int>(zalihe[i-1]-(d[i]-d[i-1]), 0);
    }
    //for(int i = 1; i<n+1; i++){cout << pojedeni[i] << " ";} cout << "\n";
    //for(int i = 1; i<n+1; i++){cout << zalihe[i] << " ";} cout << "\n";

    for (int i = 0; i<q; i++){
        long long k;
        cin >> k;
        int j;
        j = lower_bound(d, d + n + 1, k) - d;
        //cout << " ^ " << j << "\n";
        cout << pojedeni[j-1]+min(zalihe[j-1], k - d[j-1]) << "\n";
    }
    return 0;
}