using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

class Zadatak
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split();
        Int64 N = Int64.Parse(s[0]);
        Int64 Q = Int64.Parse(s[1]);
        Int64[] di = new Int64[N];
        Int64[] pi = new Int64[N];
        Int64[] kj = new Int64[Q];
        Int64 br = 0;
        for(int i = 0; i < N; i++)
        {
            string[] x = Console.ReadLine().Split();
            di[i] = int.Parse(x[0]);
            pi[i] = int.Parse(x[1]);
        }
        for (int j = 0; j < Q; j++)
        {
            br = 0;
            kj[j] = Int64.Parse(Console.ReadLine());  
            for (int i = 0; i < N; i++)
            {
                if (di[i] < kj[j])
                {
                    if (pi[i] <= kj[j] - di[i])
                    {
                        br += pi[i];
                    }
                    else
                    {
                        br += kj[j] - di[i] + 1;
                    }
                }
            }
            Console.WriteLine(br);
        }
    }
}