using System;
using System.Reflection.Metadata.Ecma335;

namespace Programme
{
    class Programme
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(s[0]);
            int q = Convert.ToInt32(s[1]);
            long[,] arr = new long[n,2];
            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split(' ');
                arr[i, 0] = Convert.ToInt64(s[0]);
                arr[i, 1] = Convert.ToInt64(s[1]);
            }
            string[] answers = new string[q];
            long currentSupplyDrop = 0;
            long currentDay = 0;
            long day = 0;
            long currentSupply = 0;
            long totalEaten = 0;
            for (int i = 0; i < q; i++)
            {
                day = Convert.ToInt64(Console.ReadLine());
                while ((currentSupplyDrop < n) && (arr[currentSupplyDrop,0] <= day))
                {
                    if (currentSupply >= (arr[currentSupplyDrop,0] - currentDay))
                    {
                        totalEaten += (arr[currentSupplyDrop, 0] - currentDay);
                        currentSupply += (arr[currentSupplyDrop, 1] - ((arr[currentSupplyDrop, 0] - currentDay)));
                    }
                    else
                    {
                        totalEaten += (currentSupply + 1);
                        currentSupply = (arr[currentSupplyDrop, 1] - 1);
                    }
                    currentDay = arr[currentSupplyDrop, 0];
                    currentSupplyDrop++;
                }
                if ((currentSupply >= (day - currentDay)) && (day != currentDay))
                {
                    totalEaten += (day - currentDay);
                    currentSupply -= (day - currentDay);
                }
                else if (day != currentDay)
                {
                    totalEaten += currentSupply;
                    currentSupply = 0;
                }
                currentDay = day;
                answers[i] = totalEaten.ToString();
            }
            for (int i = 0; i < answers.Length; i++)
            {
                Console.WriteLine(answers[i]);
            }
        }
    }
}