#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, q;
    cin >> n >> q;
    vector<long long > denj(n);
    vector<long long> pokupka(n);
    vector<long long> vopros(q);
    vector<long long> zapas(n);
    vector<long long> sjela(n); 
    for(int i = 0; i < n; i++)
    {
        cin >> denj[i] >> pokupka[i];
    }
    for(int i = 0; i < q; i++)
    {
        cin >> vopros[i];
    }
    zapas[0] = pokupka[0] - 1;
    sjela[0] = 1;
    for(int i = 1; i < n; i++)
    {
        if(zapas[i - 1] >= denj[i] - denj[i - 1] - 1)
        {
            zapas[i] = zapas[i - 1];
            sjela[i] = sjela[i - 1] + denj[i] - denj[i - 1];
            zapas[i] -= denj[i] - denj[i - 1];
            zapas[i] += pokupka[i];
        }
        else
        {
            zapas[i] = pokupka[i] - 1;
            sjela[i] = sjela[i - 1] + zapas[i - 1] + 1;
        }
    }
    for(int i = 0; i < n; i++)
    {
        //cout << denj[i] << " "<< pokupka[i] << " "<< sjela[i] << " "<< zapas[i] << "\n";
    }
    for(int i = 0; i < q; i++)
    {
        if (vopros[i] < denj[0]) cout << 0 << "\n";
        else
        {
            int l = 0, r = n;
            while(r - l > 1)
            {
                int mid = (r + l) / 2;
                if(denj[mid] > vopros[i]) r = mid;
                else l = mid;
            }
            long long ans = sjela[l];
            if(zapas[l] >= vopros[i] - denj[l]) ans += vopros[i] - denj[l];
            else ans += zapas[l];
            cout << ans << "\n";
        }
    }
}