#include <bits/stdc++.h>

using namespace std;

int main() 
{
    int n, q;
    cin >> n >> q;
    
    vector<long long> d;
    vector<long long> p;
    long long pitanje[q];
    long long trenutni[n];
    long long suma[n];
    
    
    
    for (int i = 0; i < n; i++)
    {
        long long d1, p1;
        cin >> d1 >> p1;
        
        d.push_back(d1);
        p.push_back(p1);
        
        if (i == 0)
        {
            trenutni[i] = p[i] - 1;
            suma[i] = p[i];
        }
        else
        {
            trenutni[i] = trenutni[i-1] - min(d[i] - d[i-1], trenutni[i-1]) + p[i] - 1;
            suma[i] = suma[i - 1] + p[i];
        }
        
    }
    
    for (int i = 0; i < q; i++)
    {
        cin >> pitanje[i];
        auto it = lower_bound(d.begin(), d.end(), pitanje[i]);
        if (*it == pitanje[i])
        {
          cout << suma[it - d.begin()] - trenutni[it - d.begin()] << endl;
        }
        else
        {
          if (pitanje[i] < d[0])
          {
            cout << 0 << endl;
          }
          else
          {
            int index = it - d.begin() - 1;
            cout << suma[index] - trenutni[index] + min(pitanje[i] - d[index], trenutni[index]) << endl;
          }
          
        }
    }
    
    
    return 0;
}