#include <bits/stdc++.h>
using namespace std;
int Data[100005];
int main() {
  int n, m;
  cin >> n >> m;
  int temp = 0;
  int i, c, t;
  for (i = 1; i <= n; i++) {
    cin >> c;
    cin >> t;
    temp += c * t;
    Data[i] = temp;
  }
  Data[0] = 0;
  int j = 1;
  int v;
  for (i = 0; i < m; i++) {
    cin >> v;
    int ans;
    while (j <= n) {
      if (Data[j] < v)
        j++;
      else if (Data[j] == v) {
        ans = j;
        break;
      } else if (Data[j] > v) {
        if (j == 1) {
          ans = 1;
          break;
        } else {
          ans = j;
          j--;
          break;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
