#include <iostream>
#include <cstdint>
#include <algorithm>

uint64_t odgovor(uint64_t *D, uint64_t *P, uint64_t k, uint64_t n, uint64_t kp, uint64_t op){
  static int i = 0;
  uint64_t s = op + std::min(k - kp, P[i-1] - std::min(P[i-1], kp-D[i-1]+1));
  while(D[i] <= k && i < n){
    s += std::min(P[i], k-D[i]+1);
    i++;
    if(s >= k) return k;
  }
  return s;
}

int main(){
  uint64_t *D = new uint64_t[300000];
  uint64_t *P = new uint64_t[300000];
  uint64_t n, nq, q, d, p;

  std::cin >> n >> nq;
  for(int i = 0; i < n; i++){
    std:: cin >> d >> p;
    D[i] = d;
    P[i] = p;
  }
  uint64_t *O = new uint64_t[300000];
  uint64_t kp = 0, op = 0;
  for(int i = 0; i < nq; i++){
    std::cin >> q;
    uint64_t o = odgovor(D, P, q, n, kp, op);
    O[i] = o;
    kp = q;
    op = o;
  }
  for(int i = 0; i < nq; i++){
    std::cout << O[i] << "\n";
  }
}