#include <iostream>
using namespace std;

int main() {
    long long int dayCount, questionCount;
    cin >> dayCount >> questionCount;
    long long int days[dayCount];
    long long int packs[dayCount];
    for (long long int i = 0; i < dayCount; i++) {
        cin >> days[i] >> packs[i];
    }
    long long int packsEaten = 0, packsLeft = 0, prevQuestion = 0;
    for (long long int i = 0; i < questionCount; i++) {
        long long int question;
        cin >> question;
        long long int lastDay = 0;
        for (long long int j = 0; j < dayCount; j++) {
            if (days[j] > question) break;
            if (days[j] <= prevQuestion) continue;
            if (j == 0) packsEaten++;
            else packsEaten += min(packsLeft + 1, days[j] - days[j-1]);
            packsLeft += packs[j]-1;
            lastDay = days[j];
        }
        long long int packsEatenLeft = min(packsLeft, question - lastDay);
        packsEaten += packsEatenLeft;
        packsLeft -= packsEatenLeft;
        cout << packsEaten << endl;
        prevQuestion = question;
    }
    return 0;
}