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

typedef unsigned long long ull;
int main()
{
    int n, q;
    cin>>n>>q;
    vector <ull> d, k;
    vector <ull> p;
    for(int i=0;i<n;i++)
    {
        ull a, b;
        cin>>a>>b;
        d.push_back(a);
        p.push_back(b);
    }
    for(int j=0;j<q;j++)
    {
        ull x, suma=0;
        cin>>x;
        for(int i=0;i<distance(d.begin(), upper_bound(d.begin(), d.end(), x)); i++)
        {
            suma+=(min(min(d[i+1], x)-d[i]+1, p[i]));
        }
        k.push_back(suma);
    }
    for(int i=0;i<q;i++)
        cout<<k[i]<<endl;
}