#include <bits/stdc++.h>
#define int long long

using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n , t , x , y , prosli1 , prosli2 , x1;
    cin>>n>>t;
    vector<int> v(n);
    map <int , pair<int , int>>m;
    cin>>x>>y;
    m[x] = {0 , y};
    x1 = x;
    prosli1 = 0;
    prosli2 = y;
    v[0] = x;
    for (int i = 1; i<n; i++){
        cin>>x>>y;
        v[i] = x;
        m[x] = {prosli1 + min(prosli2 , x-x1)    ,    y + max(prosli2 - (x-x1) , 0LL)};
        x1 = x;
        prosli1 = m[x].first;
        prosli2 = m[x].second;
    }

//    for (int i = 0; i<n; i++){
//        cout<<m[v[i]].first<<m[v[i]].second<<"\n";
//    }

    int pocetak = 0;


    for (int i = 0; i<t; i++){
        cin>>x;
        //x++;
        for (int j = pocetak; j<n; j++){
            if (v[j] > x){
                pocetak = j;
                break;
            }
            if (j == n-1){
                pocetak = j;
            }
        }

        if (x >= v[n-1]){
            pocetak = n;
        }

        if (x < v[0]){
            cout<<"0\n";
            continue;
        }else if (x == v[0]){
            cout<<"1\n";
            continue;
        }

        cout<<m[v[pocetak-1]].first + min(x + 1 - v[pocetak-1], m[v[pocetak-1]].second)<<"\n";

    }

    return 0;
}