#include <bits/stdc++.h>

using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  long long n, q;
  cin >> n >> q;
  
  vector<long long> d(n);
  vector<long long> p(n);
  
  for(long long i = 0; i < n; i++)
  {
    cin >> d[i] >> p[i];
  }
  
  long long j = 0;
  long long pojedeno = 0;
  long long odd = -1;
  long long dod = -2;
  
  for(long long i = 0; i < q; i++)
  {
    long long qi;
    cin >> qi;
    
    while(d[j] <= qi && j < n)
    {
      if(odd != -1 && dod < d[j])
      {
        pojedeno += dod - odd + 1;
        odd = d[j];
        dod = d[j] + p[j] - 1;
      }
      else if(odd != -1 && dod >= d[j])
      {
        dod += p[j];
      }
      else
      {
        odd = d[j];
        dod = d[j] + p[j] - 1;
      }
      
      j++;
    }
    
    pojedeno += min(qi, dod) - odd + 1;
    if(dod > qi)
    {
      odd = qi + 1;
    }
    else
    {
      odd = -1;
      dod = -2;
    }
    
    cout << pojedeno << endl;
  }
  
  return 0;
}