#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

#define ios ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define inf 1e15
#define llinf LLONG_MAX
#define mt make_tuple
#define mp make_pair
#define parll pair<ll,ll>
#define parii pair<int,int>
#define frs first
#define sec second
#define neparno(x) (x&1)
#define parno(x) (!neparno(x))
#define lowbit(x) (x&-x)
#define nzd __gcd
#define nzs(e1,e2) ((e1*e2)/nzd(e1,e2))
#define yesno(x) cout << ((x)?"Yes\n":"No\n")
#define condcout(x,y,z) cout << ((x)?y:z) << "\n"
#define all(V) V.begin(),V.end()
#define fill(V,v) fill(all(V),v)
#define l_b(BRL,brl) lower_bound( BRL.begin(), BRL.end(), brl )-BRL.begin()-1
#define u_b(BRU,bru) upper_bound( BRU.begin(), BRU.end(), bru )-BRU.begin()
#define mod 1000000007
#define mxn 300005

ll n,q,A[mxn],B[mxn],C[mxn],P[mxn];

int main()
{
    ios;

    cin >> n >> q;
    A[0] = 1; B[0] = 0;
    for ( ll i = 1; i <= n; i++ )
    {
        cin >> A[i] >> B[i];
    }

    ll k = 0;
    for ( ll i = 1; i <= n; i++ )
    {
        if ( k >= A[i]-A[i-1] )
        {
            C[i] = 0;
            k -= (A[i]-A[i-1]);
        }
        else
        {
            C[i] = A[i]-A[i-1]-k;
            k = 0;
        }
        k += B[i];
    }
    A[n+1] = A[n]+k;
    B[n+1] = 0;
    C[n+1] = 0;
    n++;

    P[0] = 0;
    for ( ll i = 1; i <= n; i++ )
    {
        P[i] = P[i-1]+C[i];
    }

    ll x;
    while ( q-- )
    {
        cin >> x;
        ll t = upper_bound(A+1,A+n+1,x)-A;
        if ( t > n )
        {
            t = n;
            x = A[n];
        }
        ll rez = max( x-(A[t]-1-C[t]), 0ll );
        rez += P[t-1];
        cout << x-rez << "\n";
    }

    return 0;
}