//Dedicated to my love,ivaziva
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
// #ifndef ONLINE_JUDGE
// #include "C:\Users\andre\Downloads\cpp-dump-0.7.0\cpp-dump-0.7.0\cpp-dump.hpp"
// #define dbg(...) cpp_dump(__VA_ARGS__)
// #else
// #define dump(...)
// #endif 
using namespace std;
typedef long long ll;
typedef long double ldb; 
using namespace __gnu_pbds;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> order_set;
const int mxN=3e5+50;  
const ldb eps=0.000001;
const int mod=998244353; //998244353 1e9+7
const int iinf=2e9;
const ll inf=2e18; 
int n,q;
ll d[mxN],p[mxN],bn[mxN],ps[mxN];
int main()
{ 
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> q;
    for(int i=1; i<=n; i++) cin >> d[i] >> p[i];
    ll r=0;
    for(int i=1; i<=n; i++)
    {
        if(i<n)
        {               
            bn[i]=min(d[i+1]-1,r+d[i]+p[i]-1); 
            ps[i]=(ps[i-1]+bn[i]-d[i]+1); 
            r+=(p[i]-d[i+1]+d[i]); 
            r=max(r,0ll);
        }
        else
        {   
            bn[i]=(r+d[i]+p[i]-1); 
            ps[i]=(ps[i-1]+bn[i]-d[i]+1); 
        }
    } 
    d[0]=0;
    while(q--)
    {
        ll k; cin >> k;
        int bot=0,top=n,idx; 
        while(bot<=top)
        { 
            int mid=(bot+top)/2; 
            if(k>=d[mid])
            {
                bot=mid+1;
                idx=mid;
            }
            else
            {
                top=mid-1; 
            }
        }     
        if(idx==0) cout << 0 << "\n"; 
        else if(k>=bn[idx]) cout << ps[idx] << "\n";  
        else
        {   
            ll ans=(ps[idx-1]+k-d[idx]+1); 
            cout << ans << "\n"; 
        }
    }
    return 0;
}