#include <bits/stdc++.h>
using namespace std;

int main() {
   int n,q;
   cin>>n>>q;
   vector <int> a(q,0);
   int d[n];
   int p[n];
   int k[q];
   for (int i=0;i<n;i++) {
       cin>>d[i]>>p[i];
   }
   for (int i=0;i<q;i++) {
       cin>>k[i];
   }
   for (int i=0;i<q;i++) {
     for (int j=0;j<n;j++) {
       if (abs(k[i]-d[j])<=p[j]) {
         a[i]+=abs(k[i]-d[j])+1;
         k[i]=d[j];
       } else {
         a[i]+=p[i];
       }
     }
     cout<<a[i]<<endl;
   }
}