#include <bits/stdc++.h>

using namespace std;

int main()
{
    std::ios_base::sync_with_stdio(false);
    unsigned long long n,q;
    cin >> n >> q;

    vector<pair<unsigned long long,unsigned long long>> d;
    vector<unsigned long long> dist;
    vector<unsigned long long> answer;
    dist.push_back(0);
    unsigned long long pd;

    for(unsigned long long i=0; i<n; i++)
    {
        unsigned long long da,na;
        cin >> da >> na;
        if(i!=0)dist.push_back(da-pd+1);
        pd=da;
        d.push_back(make_pair(da,na));

    }


    for(unsigned long long i=0; i<q; i++)
    {
        unsigned long long question;
        cin >> question;
        unsigned long long ans=0;
        unsigned long long stockpile=0;
        bool dosaodoquestion=false;

        for(unsigned long long j=0; j<n && !dosaodoquestion; j++)
        {
            if(d[j].first<question && d[j+1].first>question)
            {
                 stockpile+=d[j].second;
                 unsigned long long danaJeo=question-d[j].first+1;
                 if(stockpile>=danaJeo)
                 {
                     ans+=danaJeo;
                     stockpile-=danaJeo;
                 }
                 else
                 {
                     ans+=stockpile;
                     stockpile=0;
                 }
                dosaodoquestion=true;

            }
            else if(d[j].first<question)
            {
                stockpile+=d[j].second;
                if(dist[j+1]<stockpile)
                {
                    ans+=dist[j+1];
                    stockpile-=dist[j+1];
                }
                else
                {
                    ans+=stockpile;
                    stockpile=0;
                }
            }
            else
            {
                if(question<stockpile)
                {
                    ans+=question;
                    stockpile-=question;
                }
                else
                {
                    ans+=stockpile;
                    stockpile=0;
                }
                dosaodoquestion=true;
            }
        }
        if(pd<question && !dosaodoquestion)
        {
            if(question-pd<stockpile)
            {
                ans+=question-pd+1;
                stockpile-=question-pd+1;
            }
            else
            {
                ans+=stockpile;
                stockpile=0;
            }
        }

        answer.push_back(ans);
    }

    for(unsigned long long i=0; i<q; i++)
    {
        cout << answer[i] << endl;
    }

    return 0;
}