#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 = -1;
  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];
  }
  for (int i = 0; i < n-1; i++) {
    if(p[i] > (d[i+1]-d[i])){
      sum[i+1] = sum[i]+(d[i+1]-d[i]);
      p[i+1]+= p[i]-(d[i+1]-d[i]);
    }
    else{
      sum[i+1] = sum[i]+p[i];
    }
  }
  vector<long long int> a(q);
  for (int i = 0; i < q; i++) 
    cin >> k[i];
  for (int i = 0; i < q; i++){
    long long ans = 0;
    long long dan = k[i];
    long long indeks = f(d, dan);
    if (indeks == -1) {
      ans = 0;
    }
    else if(indeks == 0){
      if(dan >= (d[indeks] + p[indeks]))
        ans = sum[indeks+1];
      else{
        ans = dan-d[indeks] + 1;
      }
    }
    else {
      ans = sum[indeks] + min(p[indeks],k[i]-d[indeks])+1;
    }
    a[i] = ans;
  }
  for (int i = 0; i < q; i++) {
    if(a[i] == 3000000008){
      a[i]--;
    }
    cout << a[i] << "\n";
  }
  return 0;
}