#include <iostream>

using namespace std;

int najmanji(int a, int b, int c){
    if(a < b && a < c)
        return a;
    if (b < c)
        return b;
    return c;
}
int najmanji(int a, int b){
    if(a < b)
        return a;
    return b;
}
int main()
{
    int n, q, k = 0, l = 0;
    long long int t = 0;
    cin >> n >> q;
    long long int d[n];
    long long int p[n];
    long long int u[q];
    long long int o[q];
    for(int i = 0; i < n; i++){
        cin >> d[i] >> p[i];
    }
    for(int i = 0; i < q; i++){ 
        cin >> u[i];
    }
    while(l < q){
        if (k < n - 1) {
            long long int minimum = najmanji((d[k + 1] - d[k]),(u[l] - d[k]), p[k]);
            if (minimum == u[l] - d[k]) {
                int pomoc = t;
                t += u[l] - d[k] + 1;
                if(t < 0)
                    t = 0;
                o[l] = t;
                t = pomoc;
                l++;
            } else if (minimum == d[k + 1] - d[k]) {
                p[k + 1] += p[k] - d[k + 1] + d[k];
                t += d[k + 1] - d[k];
                k++;
            } else {
                t += p[k];
                k++;
            }
            }
        else if (k == n - 1){
            long long int minimum = najmanji((u[l] - d[k]), p[k]);
            if (minimum == u[l] - d[k]) {
                int pomoc = t;
                t += u[l] - d[k] + 1;
                if(t < 0)
                    t = 0;
                o[l] = t;
                t = pomoc;
                l++;
            } else {
                t += p[k];
                k++;
            }
        }
        else {
           while(l < q){
                o[l] = t;
                l++;
           }
        }
    }
    for(int i = 0; i < q; i++)
        cout << o[i] << " ";
    return 0;
}