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

namespace takm2
{
    internal class Program
    {
        static long CheckPlazmaUntilDay2(int day, long question, long[] days, long[] plazmas)
        {
            long startingDay = days[0];
            long totalPlazmas = 0;
            if (day > 0)
            {
                for (int i = 0; i < day - 1; i++)
                {
                    totalPlazmas += plazmas[i];
                }
                if (totalPlazmas + startingDay - 1 + plazmas[day - 1] >= question)
                {
                    totalPlazmas = question - startingDay + 1;
                    return totalPlazmas;
                }
                if (plazmas[day - 1] >= question - days[day - 1] + 1)
                {
                    totalPlazmas += question - days[day - 1] + 1;
                }
                else
                    totalPlazmas += plazmas[day - 1];
            }
            return totalPlazmas;
        }
        static long CheckPlazmaUntilDay3(int day, long question, long[] days, long[] plazmas)
        {
            long startingDay = days[0];
            long totalPlazmas = 0;
            for (int i = 0; i < day; i++)
            {
                totalPlazmas += plazmas[i];
            }
            if (totalPlazmas + startingDay - 1 >= question)
            {
                totalPlazmas = question - startingDay + 1;
            }
            else
            {
                totalPlazmas++;
            }
            return totalPlazmas;
        }
        static long CheckPlazmaUntilDay4(long question, long[] days, long[] plazmas)
        {
            long startingDay = days[0];
            long totalPlazmas = 0;
            for (int i = 0; i < days.Length - 1; i++)
            {
                totalPlazmas += plazmas[i];
            }
            if (totalPlazmas + startingDay - 1 >= question)
            {
                totalPlazmas = question - startingDay + 1;
                return totalPlazmas;
            }
            if (plazmas[days.Length - 1] >= question - days[days.Length - 1] + 1)
            {
                totalPlazmas += question - days[days.Length - 1] + 1;
            }
            else
                totalPlazmas += plazmas[days.Length - 1];
            return totalPlazmas;
        }
        static long CheckQuestion(long question, long[] days, long[] plazmas, int n)
        {
            long totalPlazmas = 0;
            for (int i = 0; i < n; i++)
            {
                if (question == days[i])
                {
                    totalPlazmas = CheckPlazmaUntilDay3(i, question, days, plazmas);
                    break;
                }
                else if (question < days[i])
                {
                    totalPlazmas = CheckPlazmaUntilDay2(i, question, days, plazmas);
                    break;
                }
            }
            if (question > days[days.Length - 1])
            {
                totalPlazmas = CheckPlazmaUntilDay4(question, days, plazmas);
            }
            return totalPlazmas;
        }
        static void Main(string[] args)
        {
            string[] input1 = Console.ReadLine().Split();

            int n = int.Parse(input1[0]);
            int q = int.Parse(input1[1]);

            long[] d = new long[n];
            long[] p = new long[n];
            long[] k = new long[q];

            for (int i = 0; i < n; i++)
            {
                string[] inputdp = Console.ReadLine().Split();
                d[i] = Convert.ToInt64(inputdp[0]);
                p[i] = Convert.ToInt64(inputdp[1]);
            }

            for (int i = 0; i < q; i++)
            {
                k[i] = Convert.ToInt64(Console.ReadLine());
            }
            for (int i = 0; i < q; i++)
                Console.WriteLine(CheckQuestion(k[i], d, p, n));
        }
    }
}