#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[100001], l = 1;
  for (int i = 1; i <= n; i++) {
    int c, t;
    cin >> c >> t;
    int x = c * t;
    a[l] = c * t;
    l++;
  }
  int d = 1, s = 0;
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    if (s + a[d] >= k) {
      cout << d << endl;
    } else {
      while (1) {
        s += a[d];
        d++;
        if (s + a[d] >= k) {
          cout << d << endl;
          break;
        }
      }
    }
  }
  return 0;
}
