#include <bits/stdc++.h>

using namespace std;

long long f(vector<long long int> arr, long long K) {
  long long maksElement = 0;
  long long indeks = 0;
  for (long long i = 0; i < arr.size();++i) {
    if (arr[i] < K && arr[i] > maksElement) {
      maksElement = arr[i];
      indeks = i; 
    }
  }
  return indeks;
}

int main() {
  int n,q;
  cin >> n >> q;
  vector<long long int> sum(n);
  vector<long long int> d(n);
  vector<long long int> p(n);
  vector<long long int> k(q);
  for (int i = 0; i < n; i++) {
    cin >> d[i] >> p[i];
  }
  sum[0] = 0;
  for (int i = 1; i < n; i++) {
    sum[i] = sum[i - 1] + p[i-1];
  } 
  for (int i = 0; i < n; i++) {
    cout << sum[i] << " ";
  } 
  cout << "\n";
  vector<long long int> a(q);
  for (int i = 0; i < q; i++) {
    long long ans = 0;
    cin >> k[i];
    long long int index = f(d, k[i]);
    if (index != 0) {
      ans += sum[index];
      a[i] = ans;
      ans += (k[i] - d[index])+1;
      continue;
    }
    a[i] = ans;
    cout << "index: " << index << "\n";
    cout << "ans: " << ans << "\n";
  }
  for (int i = 0; i < q; i++) {
    cout << a[i] << "\n";
  }
  return 0;
}