#include <iostream>
 
using namespace std;
 
const int MAX = 300001;
unsigned long long dankup[MAX], brkup[MAX], upiti[MAX];
 
int main()
{
    int n, q;
    cin >> n >> q;
    for (int i = 0; i < n; i++) {
        cin >> dankup[i] >> brkup[i];
    }
    for (int j = 0; j < q; j++) {
        cin >> upiti[j];
    }
    unsigned long long brojac = 0;
    for (int j = 0; j < q; j++) {
        for (int i = 0; i < n; i++){
            if (upiti[j] >= dankup[i]) {
                if (upiti[j] - dankup[i] + 1 >= brkup[i]) {
                    brojac += brkup[i];
                }
                else {
                    brojac += upiti[j] - dankup[i] + 1;
                }
                if (brojac > upiti[j]) {
                    cout << upiti[j] << endl;
                    break;
                }
                if(i==n-1) {
                    cout << brojac << endl;
                    break;
                }
            }
            else {
                cout << brojac << endl;
                break;
            }
        }
        brojac = 0;
    }
}