#include <iostream>
#include <vector>
#define ll long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n, q;
    cin >> n >> q;
    vector<ll> dani, dodato;
    for (ll i = 0; i < n; i++)
    {
        ll dan, dodat;
        cin >> dan >> dodat;
        dani.push_back(dan);
        dodato.push_back(dodat);
    }
    vector<ll> output;
    for (ll i = 0; i < q; i++)
    {
        ll pitanje;
        ll out = 0;
        ll zadnji = 0;
        cin >> pitanje;
        for (ll j = 0; j < dani.size(); j++)
        {
            if (dani[j] > pitanje)
            {
                break;
            }
            ll dan, dodat;
            dan = dani[j];
            dodat = dodato[j];
            zadnji = dan + dodat - 1;
            if (zadnji > pitanje)
            {
                zadnji = pitanje;
            }
            out += zadnji - dan + 1;
        }
        output.push_back(out);
    }
    for (ll i = 0; i < output.size(); i++)
    {
        cout << output[i] << endl;
    }
}