#include <bits/stdc++.h>
using namespace std;
int suma[100001];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    int c, t;
    scanf("%d %d", &c, &t);
    if (i == 0) {
      suma[i] = c * t;
    } else {
      suma[i] = suma[i - 1] + c * t;
    }
  }
  vector<int> res;
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    int *var = lower_bound(suma, suma + n, x);
    res.push_back((var - suma) + 1);
  }
  for (int i = 0; i < res.size(); i++) {
    printf("%d\n", res[i]);
  }
}
