#include <bits/stdc++.h>
using namespace std;
long long int n, m, c, t, p[100005], l, r, mid;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++) {
    cin >> c >> t;
    p[i] = p[i - 1] + c * t;
  }
  while (m--) {
    cin >> t;
    l = 1;
    r = n;
    mid = (l + r) / 2;
    while (l < r) {
      mid = (l + r) / 2;
      if (t <= p[mid])
        r = mid;
      else
        l = mid + 1;
    }
    cout << l << endl;
  }
  return 0;
}
