#include <bits/stdc++.h>
using namespace std;
struct store {
  int song;
  int time1, time2;
  void Set(int s, int t1, int t2) {
    song = s;
    time1 = t1;
    time2 = t2;
  }
};
store input[100000 + 5];
int main() {
  int n, m, i, j, start_time = 1, end_time;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    int c, t;
    cin >> c >> t;
    end_time = start_time + (c * t);
    input[i].Set(i + 1, start_time, end_time - 1);
    start_time = end_time;
  }
  while (m--) {
    int v;
    cin >> v;
    int left = 0, right = n - 1;
    while (left <= right) {
      int mid = (left + right) / 2;
      if (v >= input[mid].time1 && v <= input[mid].time2) {
        printf("%d\n", input[mid].song);
        break;
      } else if (v > input[mid].time2) {
        left = mid + 1;
      } else {
        right = mid;
      }
    }
  }
  return 0;
}
