#include <iostream>
#include <vector>

#define LL long long

int main()
{
    int n, q;
    std::cin >> n >> q;
    
    std::vector<std::pair<LL, LL>> dani(n);
    
    LL prethodniKraj = 0;
    for (int i = 0; i < n; i++)
    {
        LL di, pi;
        std::cin >> di >> pi;
        
        prethodniKraj = std::max(prethodniKraj - di, (LL)0);
        dani[i] = { prethodniKraj + di, prethodniKraj + di + pi };
        prethodniKraj = di + pi;
    }
    
    std::vector<LL> qn(q);
    for (int i = 0; i < q; i++)
        std::cin >> qn[i];
    
    for (int i = 0; i < q; i++)
    {
        LL b = 0;
        
        int j = 0;
        while (j < n && dani[j].first <= qn[i])
        {
            if (dani[j].second > qn[i])
            {
                b += qn[i] - dani[j].first + 1;
                break;
            }
            
            b += dani[j].second - dani[j].first;
            j++;
        }
        
        std::cout << b << std::endl;
    }
    
    return 0;
}