/*#include <iostream>

using namespace std;

int main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);cout.tie(NULL);

    int c, n, z;
    cin >> c;
    cin >> z;
    cin >> n;

    int low[n];
    int high[n];
    int used[n];

    for (int i = 0; i<n; i++){
        cin >> low[i];
        used[i]=true;
    }
    int sum=0;
    for (int i = 0; i<n; i++){
        cin >> high[i];
        sum+=high[i];
    }
    int k=sum-c;
    sum=0;
    int br=0;
    while(sum<z){
        int opt=0;
        int iopt;
        for(int i= 0; i<n; i++){
            if (used[i])
                iopt=i;
        }

        for(int i = 0; i<n; i++){
            if (max(low[i], high[i]-k)>opt && used[i]){
                opt=max(low[i], high[i]-k);
                used[i]=false;
                used[iopt]=true;
                iopt=i;
            }
            else if (max(low[i], high[i]-k)==opt && used[i]){
                if(high[i]>high[iopt]){
                    used[i]=false;
                    used[iopt]=true;
                    iopt=i;
                }
            }
        }

        if(k-(high[iopt]-low[iopt])>=0){
            k-=(high[iopt]-low[iopt]);
        }
        else{
            k=0;
        }

        sum+=opt;
        br++;
        //cout << iopt << ".\n";

    }
    cout << br;




    return 0;
}
*/#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";
    int j=0;
    for (int i = 0; i<q; i++){
        long long k;
        cin >> k;
        while(d[j]<k && j<n+1){j++;}
        //cout << " ^ " << j << "\n";
        cout << pojedeni[j-1]+min(zalihe[j-1], k - d[j-1]) << "\n";
    }
    return 0;
}