#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int n, q;
    cin >> n;
    cin >> q;
    long long int** x = new long long int *[n];
    for (int i = 0; i < n; i++)
    {
        x[i] = new long long int[2];
        cin >> x[i][0];
        cin >> x[i][1];
    }

    long long int i1 = 0, i = 0;
    bool i1_promena = true;
    long long int r = 0, p = 0, k = -1;
    while (i1 < q)
    {
        if (i1_promena)
        {
            cin >> k;
            r = 0, p = 0;
            i1_promena = false;
        }
        
        p += x[i][1];
        if (k < x[0][0])
        {
            r = 0;
            i = 0;
            i1++;
            i1_promena = true;
            cout << r << endl;
            continue;
            //break;
        }
        if (i + 1 < n && k < x[i + 1][0])
        {
            if (k - x[i][0] < p)
            {
                r += k - x[i][0] + 1;
            }
            else
            {
                r += p;
            }
            i = 0;
            i1++;
            i1_promena = true;
            cout << r << endl;
            continue;
            //break;
        }
        if (i + 1 == n)
        {
            if (k > x[i][0])
            {
                if (k - x[i][0] < p)
                {
                    r += k - x[i][0] + 1;
                }
                else
                {
                    r += p;
                }
            }
            else
            {
                if (k - x[i - 1][0] < p)
                {
                    r += k - x[i][0] + 1;
                }
                else
                {
                    r += p;
                }
            }
            i = 0;
            i1++;
            i1_promena = true;
            cout << r << endl;
            continue;
            //break;
        }
        if (i + 1 < n && x[i + 1][0] - x[i][0] < p)
        {
            r += x[i + 1][0] - x[i][0];
            p -= x[i + 1][0] - x[i][0];
        }
        else
        {
            r += p;
            p = 0;
        }
        i++;
        if (i == n)
        {
            i = 0;
            i1++;
            i1_promena = true;
            cout << r << endl;
        }
    }
    
    for (int i = 0; i < n; i++)
    {
        delete[] x[i];
    }
    delete[] x;
}