using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zadatak_2_Plazma_
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] inputNQ = Console.ReadLine().Split(' ');
            long N = long.Parse(inputNQ[0]);
            long Q = long.Parse(inputNQ[1]);
            Dictionary<ulong, ulong> supplyIncrease = new Dictionary<ulong, ulong>();        //ulong-dani, long-broj paketa
            ulong packetsConsumed;
            ulong[] questions = new ulong[Q];
            for (int i = 0; i < N; i++)
            {
                string[] inputDP = Console.ReadLine().Split(' ');
                supplyIncrease.Add(ulong.Parse(inputDP[0]), ulong.Parse(inputDP[1]));                     //unos dana i paketa
            }
            for (int j = 0; j < Q; j++)
            {
                questions[j] = ulong.Parse(Console.ReadLine());                                         //pitanja
            }
            ulong[] supplyIncreaseKeys = new ulong[N];
            int f = 0;
            foreach (ulong d in supplyIncrease.Keys)
            {
                supplyIncreaseKeys[f] = d;                              //unos dana u specijalni niz posto foreach nece da ga vrti(c# momenat)
                f++;
            }

            for (int j = 0; j < Q; j++) 
            {
                packetsConsumed = 0;
                for(int i  = 0; i < N; i++)
                {
                    ulong d = supplyIncreaseKeys[i];
                    ulong supply = supplyIncrease[d];
                    if (d > questions[j])
                    {
                        supply = 0;                        //ukoliko je tata doneo plazme posle pitanja ne racuna se
                    }
                    else if(d+supplyIncrease[d] > questions[j])
                    {
                        supply = questions[j] - d+1;               //ukoliko je tata doneo dovoljno pakovanja da se ne istrose pre pitanja
                    }
                    packetsConsumed += supply;   
                }
                Console.WriteLine(packetsConsumed);
            }
        }
    }
}