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

int main() {
   int n,q;
   cin>>n>>q;
   vector <unsigned long long> a(q,0);
   unsigned long long d[n];
   unsigned long long p[n];
   unsigned long long 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(k[i]>=d[j] && k[i]-d[j]<=p[j]) {
         a[i]+=k[i]-d[j]+1;
       } else if(k[i]>=d[j] && k[i]-d[j]>p[j]) {
         a[i]+=p[j];
       } else if(k[i]<d[0]) {
         a[i]=0;
       }
    }
     cout<<a[i]<<endl;
   }
}