#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    int n, q;
    cin >> n >> q;
    long long d[n], p[n], r[n], o[n];
    for(int i = 0; i < n; i++){
        cin >> d[i] >> p[i];
    }
    
    r[0] = p[0] && 1;
    o[0] = p[0] - r[0];
    for(int i = 1; i < n; i++){
        if(o[i-1] < (d[i] - d[i-1])){
            r[i] = r[i-1] + o[i-1];
        }
        else{
            r[i] = r[i-1] + (d[i] - d[i-1]);
        }
        o[i] = o[i-1] + r[i-1] - r[i] + p[i];
    }
    long long h;
    long long rez;
    for(int i = 0; i < q; i++){
        cin >> h;
        bool ok = true;
        for(int j = 0; j < n-1; j++){
            if(h < d[j+1] && h > d[j]){
                ok = false;
                if(h-d[j] > o[j]){
                    rez = r[j] + o[j];
                }
                else{
                    rez = r[j] + h - d[j];
                }
            }
        }
        if(ok){
            int j = n-1;
            if(h-d[j] > o[j]){
                rez = r[j] + o[j];
            }
            else{
                rez = r[j] + h - d[j] + 1;
            }
        }
        if(rez < 0){
            rez = 0;
        }
        cout << rez << endl;
    }
    return 0;
}