#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


int main() 
{
    long long int N, Q;
    cin >> N >> Q;
    vector<long long int> d, p;
    vector<long long int> odgovori;
    for(long long int i = 0; i < N; i++)
    {
        long long int d1, p1;
        cin >> d1 >> p1;
        d.push_back(d1); p.push_back(p1);
    }
    for(long long int j = 0; j < Q; j++)
    {
        long long int k; cin >> k;
        long long int i1 = 0;
        long long int S = 0, preostalaPlazma = 0, dodataPlazma;
        while(d[i1] < k && i1 != N)
        {
            preostalaPlazma = preostalaPlazma + p[i1];
            if(d[i1 + 1] <= k && i1 != N - 1)
            {
                dodataPlazma = min(d[i1 + 1] - d[i1] + 1, preostalaPlazma);
            }
            else
            {
                dodataPlazma = min(k - d[i1] + 1, preostalaPlazma);
            }
            S = S + dodataPlazma;
            preostalaPlazma = preostalaPlazma - dodataPlazma;
            i1++;
        }
        odgovori.push_back(S);
        S = 0; preostalaPlazma = 0; i1 = 0;
/* 2 1
1 2
5 10
7
*/
    }
    for(int j = 0; j < Q; j++)
    {
        cout << odgovori[j] << endl;
    }
}