#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, q;
    cin >> n >> q;
    pair<long long, int> d[n];
    for(int i=0; i<n; i++)
    {
        cin >> d[i].first >> d[i].second;
    }
    long long k[q];
    for(int i=0; i<q; i++)
    {
        cin >> k[i];
    }

    long long ans = 0, pom = 0, j = 0;

    while(d[j].first <= k[0] && j<n)
    {
        if(d[j].second <= k[0]-d[j].first+1)
        {
            ans+=d[j].second;
        }
        else
        {
            ans+=k[0]-d[j].first+1;
            pom = d[j].second - k[0] + d[j].first;
        }
        j++;
    }
    cout << ans << endl;

    for(int i=1; i<q; i++)
    {
        if(pom < k[i] - k[i-1])
        {
            ans+=pom;
        }
        else
        {
            ans += k[i]-k[i-1];
            pom -= k[i]-k[i-1];
        }

        while(d[j].first <= k[i] && j<n)
        {
            if(d[j].second <= k[i]-d[j].first+1)
            {
                ans+=d[j].second;
            }
            else
            {
                ans+=k[i]-d[j].first+1;
                pom = d[j].second - k[i] + d[j].first - 1;
            }
            j++;
        }
        cout << ans << endl;
    }

    return 0;
}