#include <bits/stdc++.h>
using namespace std;
long long bSearch(long long *arr, long long n, long long x) {
  long long left = 1, right = n, mid, ans = 0;
  while (left <= right) {
    mid = (left + right) / 2;
    if (x > arr[mid]) {
      left = mid + 1;
    } else {
      right = mid - 1;
      ans = mid;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, q;
  cin >> n >> q;
  long long arr[n + 1];
  for (long long i = 1; i <= n; i++) {
    long long a, b;
    cin >> a >> b;
    arr[i] = a * b;
  }
  for (long long i = 2; i <= n; i++) {
    arr[i] = arr[i] + arr[i - 1];
  }
  cout << endl;
  while (q--) {
    long long x;
    cin >> x;
    cout << bSearch(arr, n, x) << endl;
  }
}
