using System;

namespace ConsoleApp5
{
    class Program
    {
        struct Day
        {
            public long day;
            public long plazma;
            public long days_upto;
            public long plazma_after;
        }

        static void Main(string[] args)      
        {
            string[] input = Console.ReadLine().Split();
            
            int n = int.Parse(input[0]);
            int q = int.Parse(input[1]);

            long total_plazma = 0;

            Day[] days = new Day[n];
            for (int i = 0; i < n; i++)
            {
                string[] input1 = Console.ReadLine().Split();
                days[i].day = long.Parse(input1[0]);
                days[i].plazma = long.Parse(input1[1]);
                if (i == 0)
                    days[i].days_upto = 0;
                else
                {
                    long diff = days[i].day - days[i - 1].day;
                    if (total_plazma > diff)
                    {
                        days[i].days_upto = days[i - 1].days_upto + diff;
                        total_plazma -= diff;
                    }
                    else
                    {
                        days[i].days_upto = days[i - 1].days_upto + total_plazma;
                        total_plazma = 0;
                    }
                }
                total_plazma += days[i].plazma;
                days[i].plazma_after = total_plazma;
            }


            for(int i=0; i<q; i++)
            {
                long last_day = long.Parse(Console.ReadLine());
                int k = 0;
                while (k<n && days[k].day < last_day)
                    k++;
                k--;
                if (k == -1)
                    Console.WriteLine(0);
                else
                {
                    long total = days[k].days_upto;
                    long plazma = days[k].plazma_after;
                    long d = Math.Min(plazma, last_day - days[k].day + 1);

                    Console.WriteLine(total + d);
                }
            }
           
        }
    }
}