#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, le, ri, mid, v;
  cin >> n >> m;
  vector<int> a(n + 2);
  a[0] = 0;
  a[n + 1] = 1000000005;
  for (int i = 0; i < n; ++i) {
    cin >> le >> ri;
    a[i + 1] = a[i] + le * ri;
  }
  for (int i = 0; i < m; ++i) {
    cin >> v;
    le = -1;
    ri = n + 2;
    while (le < ri - 1) {
      mid = (le + ri) / 2;
      if (a[mid] < v) {
        le = mid;
      } else {
        ri = mid;
      }
    }
    cout << ri << '\n';
  }
  return 0;
}
