using System;

namespace PlazmaB
{
    internal class Program
    {
        static void Main()
        {
            long[] input;
            input = InputRead();
            long N = input[0], Q = input[1]; //N - broj kupovina, Q - broj pitanja
            long[] di = new long[N]; //d - dan
            int[] pi = new int[N]; //p - broj pakovanja
            for (int i = 0; i < N; i++)
            {
                input = InputRead();
                di[i] = input[0];
                pi[i] = (int)input[1];
            }
            long[] ki = new long[Q]; //k - dan NAKON kog ne bi jela
            for (long i = 0; i < Q; i++)
                ki[i] = long.Parse(Console.ReadLine());

            for (long q = 0; q < Q; q++)
            {
                long stockpile = 0;
                long pojela = 0;
                long day = 0;
                long checkpoint = 0;
                for (int i = 0; i < di.Length; i++)
                {
                    day = Math.Min(di[i], ki[q]);
                    if (day == di[i])
                    {
                        pojela += Math.Min(stockpile, (day - checkpoint));
                        stockpile -= Math.Min(stockpile, (day - checkpoint));
                        stockpile += pi[i];
                        checkpoint = day;
                    }
                }
                pojela += Math.Min(stockpile, ki[q] + 1 - checkpoint);
                Console.WriteLine(pojela);
            }
        }
        static long[] InputRead()
        {
            string[] input = Console.ReadLine().Split(' ');
            long[] output = new long[input.Length];
            for (long i = 0; i < input.Length; i++)
                output[i] = long.Parse(input[i]);
            return output;
        }
    }
}