#include <iostream>
#include <bits/stdc++.h>
#include <string>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);


    unsigned long long int N, Q, d, p, dProslo, pProslo, i, tr = 0, j, ukupno = 0;
    cin >> N >> Q;
    vector<pair<unsigned long long int, unsigned long long int>> plazma;
    cin >> d >> p;
    plazma.push_back(make_pair(d, p));
    for(i=1; i<N; i++)
    {
        cin >> d >> p;
        if(d <= plazma[tr].first + plazma[tr].second)
        {
            plazma[tr].second += p;
        }
        else
        {
            tr++;
            plazma.push_back(make_pair(d, p));
        }
    }
    for(i=0; i<Q; i++)
    {
        cin >> d;
        ukupno = 0;
        for(j=0; j<=tr; j++)
        {
            if(d < plazma[j].first)
            {
                break;
            }
            else if(d <= plazma[j].first + plazma[j].second - 1)
            {
                ukupno += d - plazma[j].first + 1;
                break;
            }
            else
            {
                ukupno += plazma[j].second;
            }
        }
        cout << ukupno << endl;
    }
}