#include <bits/stdc++.h>
#define ll long long
using namespace std;
int N, Q;
ll D[300096];
ll P[300096];
ll K[300096];
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> N >> Q;
  for(int i = 1; i <= N; i++) cin >> D[i] >> P[i];
  for(int j = 1; j <= Q; j++) cin >> K[j];
  D[N + 1] = 1LL << 60;
  ll R = 0, E = 0;
  for(int i = 1, j = 1; j <= Q;)
  {
    if(D[i] <= K[j])
    {
      if(D[i] <= R) R += P[i];
      else
      {
        E += D[i] - R - 1;
        R = D[i] + P[i] - 1;
      }
      i++;
    }
    else
    {
      cout << min(K[j], R) - E << '\n';
      j++;
    }
  }
  cout << '\n';

  return 0;
}