#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    uint_fast64_t n,q;
    cin>>n>>q;
    uint_fast64_t dan[n][2];
    uint_fast64_t k[q];
    uint_fast64_t plazma=0;
    uint_fast64_t pojela=0;
    uint_fast64_t j = 0;
    uint_fast64_t z = 0;
    uint_fast64_t c = 0;
    for(uint64_t w = 0; w<n;w++)
        cin>>dan[w][0]>>dan[w][1];
    for(uint64_t r = 0;r<q;r++)
        cin>>k[r];
    while(c<q)
    {
        while(z<=k[c] && j<n)
        {
            if(j<n)
            {
            if(z==dan[j][0])
            {
               plazma += dan[j][1];
               j++;
            }
            }
            if(plazma>0)
            {
                plazma--;
                pojela++;
            }
            z++;
        }
        while(j==n && plazma>0 && k[c]!=z-1)
        {
            plazma--;
            pojela++;
            z++;
        }
        cout << pojela << endl;
        c++;
    }

}