#include <bits/stdc++.h>
#include <climits>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  unsigned int n, q;
  cin >> n >> q;
  long long pojela = 0, pakovanja = 0, index = 0;
  vector<pair<long long, long long>> sve(q + n);
  for (int i = 0; i < n; i++) {
    cin >> sve[i].first;
    cin >> sve[i].second;
  }
  for (int i = n; i < q + n; i++) {
    cin >> sve[i].first;
    sve[i].second = LONG_LONG_MAX;
  }
  sort(sve.begin(), sve.end());
  for (int i = 0; i < n + q; i++) {
    pair<long long, long long> dan = sve[i];
    if (dan.first - index > pakovanja) {
      pojela += pakovanja;
      pakovanja = 0;
    } // krmaca mrtva
    else {
      pojela += dan.first - index;
      pakovanja -= dan.first - index;
    }
    index = dan.first;
    if (dan.second == LONG_LONG_MAX) {
      cout << pojela + (pakovanja ? 1 : 0) << "\n";
      // off by one ubicu seeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
    } else {
      pakovanja += dan.second;
    }
  }
}