#include <bits/stdc++.h>
using namespace std;
int a[1000010], b[100010], c[100010];
int mn = 1e9, mx = -1e9, ans, cnt, sm;
bool ok, used[1000010];
string s, str;
int main() {
  long long cc[110010], n, m, c, t, x = 0, v;
  cin >> n >> m;
  cin >> c >> t;
  cc[0] = c * t;
  for (int i = 1; i < n; i++) {
    cin >> c >> t;
    cc[i] = (c * 1LL * t + cc[i - 1]);
  }
  for (int i = 0; i < m; i++) {
    cin >> v;
    while (cc[x] < v) {
      x++;
    }
    cout << x + 1 << endl;
  }
  return 0;
}
