#include <iostream>
#include <vector>
using namespace std;

int poz(vector<pair<long long,long long>> v, long long k){
    int l=0, d=v.size()-1, n;
    while(l<=d){
      int s=(l+d)/2;
      if(v[s].first <= k){
        n=s;
        l=s+1;
      } 
      else d=s-1;
    } 
    return n;
}

int main() 
{
    int n,q;
    cin>>n>>q;
    long long a[n+1],k;
    vector<pair<long long,long long>> v;
    v.push_back(make_pair(0,0));
    a[0]=0;
    for(int i=1;i<n+1;i++){
      long long d,p;
      cin>>d>>p;
      if(v[i-1].second-(d-v[i-1].first)>0)
        p+=v[i-1].second-(d-v[i-1].first);
      v.push_back(make_pair(d,p));
      a[i]=a[i-1]+min(v[i].first-v[i-1].first,v[i-1].second);
    }
    for(int i=0;i<q;i++){
      cin>>k;
      int p=poz(v,k);
      cout<<a[p]+min(k-v[p].first+1, v[p].second)<<endl;
  }
    return 0;
}