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

int main()
{
    int n, q; cin>>n>>q;

    vector<ulong> days(n+1);
    vector<ulong> plazma(n+1);
    vector<ulong> extra(n+1);
    days[0] = 0; plazma[0] = 0; extra[0] = 0;

    for(int i = 1; i<=n; i++)
    {
        ulong day, add; cin>>day>>add;
        days[i] = day;
        ulong diff = days[i]-days[i-1]-1;
        plazma[i] = plazma[i-1]+min(extra[i-1], diff)+1;
        extra[i] = add-1;
        if(extra[i-1]>diff) extra[i]+=extra[i-1]-diff;
    }

    int j = 0;
    for(int i=0; i<q; i++)
    {
        ulong k; cin>>k;
        while(j<n && days[j+1]<=k) j++;
        cout<<plazma[j]+min(extra[j], k-days[j])<<endl;
    }

    return 0;
}