#include <bits/stdc++.h>

using namespace std;

#define lli long long int

struct Entry {
  lli day;
  lli left;
  lli eaten;
};

bool compare(lli val, const Entry entry) { return val < entry.day; }

int main() {
  int n, q;
  cin >> n >> q;
  vector<Entry> data(n);

  cin >> data[0].day >> data[0].left;
  data[0].eaten = 0;
  for (int i = 1; i < n; i++) {
    lli left;
    cin >> data[i].day >> left;
    data[i].left = data[i - 1].left;

    auto could_have_eaten = data[i].day - data[i - 1].day;
    if (could_have_eaten >= data[i].left) {
      data[i].eaten = data[i].left + data[i - 1].eaten;
      data[i].left = 0;
    } else {
      data[i].eaten = could_have_eaten + data[i - 1].eaten;
      data[i].left -= could_have_eaten;
    }

    data[i].left += left;
  }

  for (int i = 0; i < q; i++) {
    lli k;
    cin >> k;
    auto it = std::upper_bound(data.begin(), data.end(), k, compare);
    if (it != data.begin()) {
      --it;
      auto could_have_eaten = k - it->day + 1;
      if (could_have_eaten >= it->left) {
        cout << it->eaten + it->left << endl;
      } else {
        cout << it->eaten + could_have_eaten << endl;
      }
    } else {
      cout << "0" << endl;
    }
  }

  return 0;
}