#include <bits/stdc++.h>
using namespace std;

const int DIMN = 100005;
const int DIMQ = 300005;

int v[DIMN], t[DIMN];

int main() {
    int N, Q;
    cin >> N >> Q;
    for (int i = 1; i <= N; ++i) {
        cin >> t[i] >> v[i];
        v[i] = (v[i] > 0 ? v[i] : -v[i]);
    }

    for (int i = 1; i <= Q; ++i) {
        int q;
        cin >> q;
        int best = -1;
        long long best_y;
        for (int j = 1; j <= N; ++j) {
            if (t[j] > q) continue;
            long long y = 1LL * (q - t[j]) * v[j];
            if (best == -1 || best_y > y) {
                best = j;
                best_y = y;
            }
        }
        cout << best << " \n"[i == Q];
    }

    return 0;
}
