#include <climits>
#include <cstdio>
#include <ios>
#include <iostream>
#include <utility>
#include <vector>
using namespace std;

typedef long long ll;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);

  int n, q;
  ll coonsuum = 0, rations = 0, position = 0;
  cin >> n >> q;

  vector<pair<ll, ll>> days(n);
  vector<ll> questions(q);

  for (int i = 0; i < n; i++) {
    cin >> days[i].first;
    cin >> days[i].second;
  }
  for (int i = 0; i < q; i++) {
    cin >> questions[i];
  }

  int j = 0, i = 0;
  ll old_position;
  while (j < q) {
    old_position = position;
    position = (questions[j] < days[i].first ? questions[j] : days[i].first);

    ll diff = position - old_position;
    if (diff > rations) {
      coonsuum += rations;
      rations = 0;
    } else {
      coonsuum += diff;
      rations -= diff;
    }

    if (questions[j] < days[i].first) {
      cout << coonsuum + (rations > 0) << endl;
      j++;
    } else {
      rations += days[i].second;
      i++;
      if (i == n) {
        days.push_back(make_pair(LONG_LONG_MAX, 0));
      }
    }
  }

  return 0;
}