#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const int MAX = 1e7;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  while (cin >> n >> m) {
    vector<pair<int, int>> v(n);
    int st = 0;
    for (int i = 0; i < n; i++) {
      int c, t;
      cin >> c >> t;
      v[i] = make_pair(st + 1, st + c * t);
      st += c * t;
    }
    for (int i = 0; i < m; i++) {
      int q;
      cin >> q;
      int s = 0, e = n - 1;
      while (s <= e) {
        int mid = (s + e) / 2;
        if (q >= v[mid].first && q <= v[mid].second) {
          cout << mid + 1 << "\n";
          break;
        } else if (q > v[mid].second)
          s = mid + 1;
        else
          e = mid - 1;
      }
    }
  }
  return 0;
}
