#include <iostream>
#include <algorithm>

using namespace std;

typedef unsigned long long ull;

#define MAX 300000
ull days[MAX],eaten[MAX],supply[MAX];

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  
  int n,q; cin>>n>>q;

  ull tE = 0, tG = 0;

  for (int i = 0;i<n; ++i){
    ull d,p,e = 1; cin>>d>>p;

    days[i] = d;
    tG += p;
    tE++;

    if (i > 0){
      e+=eaten[i-1];
      ull a = min((d-days[i-1])-1,supply[i-1]);

      e+=a;
      tE+=a;
    }

    ull s = tG-tE;

    eaten[i] = e;
    supply[i] = s;
  }

  for (int i = 0;i<q; ++i){
    ull k; cin>>k;

    int l = 0, r = n-1;
    ull total = 0;

    while (r>=l){
      int m = (r+l)*0.5;
      auto d = days[m];

      if (d == k) {
        total = eaten[m];
        break;
      }

      if (r==l && d<k){
        total = eaten[r] + min(k - days[r],supply[r]);
        break;
      }

      if (d > k){
        r = m-1;
      }else{
        l = m+1;
      }
    }

    cout<<total<<'\n';
  }

  return 0;
}