#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using mpii = map<int, int>;
using mpll = map<ll, ll>;
using mpci = map<char, int>;
using si = set<int>;
using sll = set<ll>;
using sll = set<ll>;
using vll = vector<ll>;
using pii = pair<int, int>;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vi vc;
  ll total = 0;
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    total += x * y;
    vc.push_back(total);
  }
  int pos = 0;
  while (m--) {
    int x;
    scanf("%d", &x);
  up:
    if (x <= vc[pos]) {
      printf("%d", pos + 1);
      printf("\n");
    } else {
      pos++;
      goto up;
    }
  }
  return 0;
}
