#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
    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];
    }
    for(int i = 1; i <= n; i++)
    {
       dd[i] =  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 != n){
      for(int j = 1; j < a; j++){
          sol[i] += dd[j];
         // cout << "sol += " << dd[j] << endl;
      }
      sol[i]+= min(k[i] - d[a], p[a]);
      
      //cout << "sol += " << min(k[i] - d[a], p[a]) << " gde su k[i], d[a]=, p[a] =  " << k[i] << " " <<  a << " " << p[a];}
      }else {
          for(int b = 1; b < n; b++)
          {
              sol[i]+= dd[b];
              //cout << " soli += " << dd[b];
          }
          sol[i] += dd[n]- k[i];
      }
    }
    for(int i = 0; i < q; i++)
    {
        cout << sol[i] << endl;
    }
    
    
    
    
    return 0;
}