#include <bits/stdc++.h>
using namespace std;
int next(int arr[], int target, int end) {
  int start = 0;
  int ans = 0;
  while (start <= end) {
    int mid = (start + end) / 2;
    if (arr[mid] >= target) {
      ans = mid;
      end = mid - 1;
    } else {
      start = mid + 1;
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int z = 1;
  while (z--) {
    int n, m;
    cin >> n >> m;
    int prefix_sum[n];
    for (int i = 0; i < n; ++i) {
      int c, t;
      cin >> c >> t;
      if (i)
        prefix_sum[i] = (c * t) + prefix_sum[i - 1];
      else
        prefix_sum[i] = c * t;
    }
    int v[m];
    for (int i = 0; i < m; ++i) {
      cin >> v[i];
    }
    for (int i = 0; i < m; ++i) {
      cout << next(prefix_sum, v[i], n) + 1 << "\n";
    }
  }
  return 0;
}
