#include <bits/stdc++.h>

using namespace std;

int prviManji(long long arr[], long long target, int kraj)
{
    int start = 0;
    int ans = kraj+1;
    while (start <= kraj)
    {
        int mid = (start + kraj) / 2;

        if (arr[mid] <= target)
            start = mid + 1;
        else
        {
            ans = mid;
            kraj = mid - 1;
        }
    }
    return ans-1;
}

long long d[300010];
long long p[300010];
long long D[300010];
long long o[300010];
long long S[300010];

long long rez[300010];

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

    int n,q;
    cin>>n>>q;

    for(int i=1;i<=n;i++)
    {
        cin>>d[i]>>p[i];
    }

    for(int i=1;i<n;i++)
    {
        o[i] = o[i-1]-D[i-1]+p[i];
        D[i] = min(d[i+1]-d[i],o[i]);
        //cout<<D[i]<<'\n';
        S[i] = S[i-1]+D[i];
    }
    o[n] = o[n-1]+p[n]-D[n-1];

    int pm;
    long long k;

    for(int i=0;i<q;i++)
    {
        cin>>k;
        pm = prviManji(d,k,n);
        if(k==d[pm]) pm--;
        rez[i] = S[pm-1] + min(k-d[pm]+1,o[pm]);
        //cout<<S[pm-1]<<"\n";
    }

    for(int i=0;i<q;i++) cout<<rez[i]<<"\n";



    return 0;
}