#include <iostream>

using namespace std;

int main() {
  long long N,Q;
  cin>>N>>Q;
  long long d[N+1],p[N+1],k[Q+1];
  for(int i=1;i<=N;i++)
  {
    cin>>d[i]>>p[i];
  }
  for(int j=1;j<=Q;j++)
  {
    cin>>k[j];
  }
  for(int j=1; j<=Q;j++)
  {
    long long br=0,r=0; 
    for(int i=1;i<=N;i++)
    {
      if(d[i]>k[j])
        break;
      if(p[i]+r<k[j]-d[i]+1)
      {
        br+=p[i]+r;
        r=p[i]+r-p[i]+r;
      }
      else
      {
        br+=k[j]-d[i]+1;
        r=p[i]+r-k[j]-d[i]+1;
      }
    }
    cout<<br<<endl;
  }
}