#include <iostream>
#define ll long long
using namespace std;

int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  ll d[n], p[n];
  ll pojela[n], ostalo[n]; // PROVERI DA LI CE AUTO CAST?
  for (int i=0; i<n; i++) {
    scanf("%lld %lld", &d[i], &p[i]);
    if (i == 0) {
      pojela[i] = 0;
      ostalo[i] = p[i];
    } else {
      if (ostalo[i-1]+d[i-1]-1 >= d[i]) {
        pojela[i] = d[i]-d[i-1]+pojela[i-1];
        ostalo[i] = p[i]+(ostalo[i-1]-(d[i]-d[i-1]));
      } else {
        pojela[i] = ostalo[i-1];
        ostalo[i] = p[i];
      }
    }
  }

  /*printf("d: ");
  for (int i=0; i<n; i++)
    printf("%lld ", d[i]);
  printf("\np: ");
  for (int i=0; i<n; i++)
    printf("%lld ", pojela[i]);
  printf("\no: ");
  for (int i=0; i<n; i++)
    printf("%lld ", ostalo[i]);*/

  int i=0;
  ll k, z;
  while (q--) {
    scanf("%lld", &k);
    if (d[0]>k) {
      printf("0\n");
      continue;
    } // moze mozda binarna?
    
    while (i<n && d[i] <= k) i++;
    i--;
    z = ostalo[i]+d[i]-1; // ? - do kog dana se jede
    if (z <= k) printf("%lld\n", ostalo[i]+pojela[i]);
    else printf("%lld\n", pojela[i]+(k-d[i])+1);
  }
}