#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main () {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    bool Dk_0 = true;
    bool Pk_0 = true;

    int n, q; cin >> n >> q;
    vector<vector<int>> napadi(n, vector<int>(2));

    for (int i = 0; i < n; i++) {
        cin >> napadi[i][0] >> napadi[i][1];
        if (napadi[i][0] != 0)
            Dk_0 = false;
        if (napadi[i][1] != 0)
            Pk_0 = false;

        // Dk, Pk.
    }

    if (Pk_0) {
        vector<long long > damage(n);
        damage[0] = napadi[0][0];
        for (int i = 1; i < n; i++) {
            damage[i] = napadi[i][0] + damage[i - 1];
        }
        while (q--) {
            long long health;
            cin >> health;
            if (health > damage[n - 1]) {
                cout << -1 << endl;
            }
            else {
                int left, right, mid;
                left = 0, right = n - 1;
                while (left < right) {
                    mid = left + (right - left) / 2;
                    if (health > damage[mid]) {
                        left = mid + 1;
                    }
                    else if (health <= damage[mid]) {
                        right = mid;
                    }
                }
                cout << right + 1 << endl;
            }
        }
    }
    else if (Dk_0) {
        vector<long long> damage(n);
        damage[0] = napadi[0][1];
        long long poison = napadi[0][1];

        for (int i = 1; i < n; i++) {
            poison += napadi[i][1];
            damage[i] = damage[i-1] + poison;
        }
        while (q--) {
            long long health;
            cin >> health;
            if (health > damage[n - 1]) {
                cout << -1 << endl;
            }
            else {
                int left, right, mid;
                left = 0, right = n - 1;
                while (left < right) {
                    mid = left + (right - left) / 2;
                    if (health > damage[mid]) {
                        left = mid + 1;
                    }
                    else if (health <= damage[mid]) {
                        right = mid;
                    }
                }
                cout << right + 1 << endl;
            }
        }
    }
    else {
        vector<long long> damage(n);
        long long poison = 0;
        poison += napadi[0][1];
        damage[0] = poison;
        for (int i = 1; i < n - 1; i++) {
            poison += napadi[0][1];
            damage[i] = damage[i-1] + poison;
        }
        if (napadi[n - 1][0] >= napadi[n-1][1]) {
            damage[n-1] = damage[n-2] + napadi[n-1][0] + poison;
        }
        else {
            damage[n-1] = damage[n-2] + poison + napadi[n-1][1];
        }
    
        while (q--) {
            long long health;
            cin >> health;
            
            if (health <= napadi[0][0]) {
                cout << 1 << endl;
            }
            else if (health > damage[n - 1]) {
                cout << -1 << endl;
            }
            else {
                int left, right, mid;
                left = 0, right = n - 1;
                while (left < right) {
                    mid = left + (right - left) / 2;
                    if (health > damage[mid]) {
                        left = mid + 1;
                    }
                    else if (health <= damage[mid]) {
                        right = mid;
                    }
                }
                cout << right + 1 << endl;
            }
            
        }
    }

    return 0;
}