#include <bits/stdc++.h>
#define ull unsigned long long
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, q;
    cin >> n >> q;
    vector<ull> dani(n+1, 0);
    vector<ull> jede(n+1, 0);
    vector<ull> dop(n+1, 0);
    for(int i = 1; i <= n; i++){
        ull dan, plazma;
        cin >> dan >> plazma;
        dani[i] = dan;
        jede[i] = jede[i-1] + min(dani[i] - dani[i-1], dop[i-1]) + 1;
        dop[i] = plazma - 1 + dop[i-1] - min(dani[i] - dani[i-1], dop[i-1]);
    }
    int j = 0;
    for(int i = 0; i < q; i++){
        ull d;
        cin >> d;
        while(j <= n && dani[j] <= d){
            j++;
        }
        j--;
        cout << jede[j] + min(d-dani[j], dop[j]) << "\n";
    }
    return 0;
}