#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, q;
    cin >> n >> q;
    int d[n];
    int p[n];
    int k[q];
    int dd[n+1];int sol[q];
    
    for(int i = 0; i <n;i++){
        cin >> d[i] >> p[i];
        if(i != 0){
            int g = max((long long)0, (p[i-1] - (d[i]-d[i-1])));
            p[i] += g;
            p[i-1] -= g;
        }
    }
     
    for(int i = 0; i < q;i++)
    {
        cin >> k[i];
    }
    dd[0] = 0;
    for(int i = 1; i <= n; i++)
    {
       dd[i] = dd[i-1] + p[i-1];
       //cout << dd[i] << endl;
       
    }
    for(int i = 0; i < q; i++)
    {
        sol[i] =0;
      int a =  lower_bound(d, d+n, k[i])-d;
      if(a==0){ sol[i] =0;}
      else if(a != n){
   // cout << "izmedu, i = " << i << " a = " << a << " dd[a-1] = " << dd[a-1] <<min(k[i] - d[a-1], p[a-1]) << endl; 
      sol[i] += dd[a-1];
      sol[i]+= min(k[i] - d[a-1]+1, p[a-1]);
      
      }else {
        
         // cout << " ovde";
          sol[i] = dd[n-1] + min(k[i] - d[n-1]+1, p[n-1]);
      }
    }
    //cout << endl << endl << endl << endl;
    for(int i = 0; i < q; i++)
    {
        cout << sol[i] << endl;
    }
    
    
    
    
    return 0;
}