#include <bits/stdc++.h>
using namespace std;
template <typename T>
T BigMod(T b, T p, T m) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = BigMod(b, p / 2, m);
    return ((s % m) * (s % m)) % m;
  }
  return ((b % m) * (BigMod(b, p - 1, m) % m)) % m;
}
template <typename T>
T ModInv(T b, T m) {
  return BigMod(b, m - 2, m);
}
template <typename T>
void ia(T a[], int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void pa(T a[], int n) {
  for (int i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
template <typename T>
T gcd(T a, T b) {
  if (!b) return a;
  return gcd(b, a % b);
}
template <typename T>
T POW(T b, T p) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    T s = POW(b, p / 2);
    return s * s;
  }
  return b * POW(b, p - 1);
}
struct node {
  int st, ed;
  node() {}
  node(int a, int b) {
    st = a;
    ed = b;
  }
};
node tree[5 * 100005];
node a[100005];
void build(int idx, int l, int r) {
  if (l == r) {
    tree[idx] = a[l];
    return;
  }
  int mid = (l + r) >> 1, lft = idx << 1, rgt = lft | 1;
  build(lft, l, mid);
  build(rgt, mid + 1, r);
  tree[idx].st = tree[lft].st;
  tree[idx].ed = tree[rgt].ed;
}
long long query(int idx, int l, int r, int val) {
  if (l == r) {
    return l;
  }
  int mid = (l + r) >> 1, lft = idx << 1, rgt = lft | 1;
  if (val <= tree[lft].ed)
    return query(lft, l, mid, val);
  else
    return query(rgt, mid + 1, r, val);
}
int main() {
  int n, m, c, t;
  cin >> n >> m;
  int st = 1;
  int M = 0;
  for (int i = 0; i < n; i++) {
    cin >> c >> t;
    int ed = c * t + st - 1;
    a[++M] = node(st, ed);
    st = ed + 1;
  }
  build(1, 1, M);
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    cout << query(1, 1, M, x) << endl;
  }
  return (0);
}
