#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++)
    {
        LL kj;
        std::cin >> kj;
        qn[i] = kj;
    }
    
    for (int i = 0; i < q; i++)
    {
        LL b = 0;
        
        for (LL j = 0; j < dani.size(); j++)
        {
            if (dani[j].first > qn[i])
                break;
            if (dani[j].second > qn[i])
            {
                b += qn[i] - dani[j].first + 1;
                break;
            }
            
            b += dani[j].second - dani[j].first;
        }
        
        std::cout << b << std::endl;
    }
    
    return 0;
}