#include<bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, q;
  long long d, p, k, t = 2000000000000000000;
  cin >> n >> q;
  vector<vector<long long>> v(n, vector<long long>(3));
  cin >> d >> p;
  v[0][0] = d;
  v[0][1] = 1;
  v[0][2] = p - 1;
  for (int i = 1; i < n; i++) {
    cin >> d >> p;
    v[i][0] = d;
    v[i][1] = v[i - 1][1] + min(d - v[i - 1][0] - 1, v[i - 1][2]) + 1;
    v[i][2] = p - 1 + max(v[i - 1][2] - (d - v[i - 1][0]) + 1, (long long)0);
  }
  /*for (vector<long long> x : v) {
    for (long long y : x)
      cout << y << " ";
    cout << "\n";
  }*/
  for (int i = 0; i < q; i++) {
    cin >> k;
    vector<long long> vt = {k, t, t};
    long long a = upper_bound(v.begin(), v.end(), vt) - v.begin() - 1;
    //cout << a << endl;
    if (a == -1)
      cout << "0\n";
    else
      cout << v[a][1] + min(k - v[a][0], v[a][2]) << "\n";
  }
  return 0;
}