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

namespace ConsoleApp2
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split(' ');
            int n = int.Parse(unos[0]);
            int q = int.Parse(unos[1]);
            Queue<Int64> dan = new Queue<Int64>();
            Queue<Int64> plzm = new Queue<Int64>();
            for (int i = 0; i < n; i++) { 
                unos = Console.ReadLine().Split(' ');
                dan.Enqueue(Int64.Parse(unos[0]));
                plzm.Enqueue(Int64.Parse(unos[1]));
            }
            Int64 stek = 0,stomak=0,prethodni=0,trazen,x=0,y;
            for (int i = 0; i < q; i++)
            {
                trazen=Int64.Parse(Console.ReadLine());
                while (dan.Count!=0&&(x=dan.Peek()) <= trazen)
                {
                    dan.Dequeue();
                    y = plzm.Dequeue();
                    if (x - prethodni < stek)
                    {
                        stomak += x - prethodni;
                        stek = y+stek-(x - prethodni);
                    }
                    else
                    {
                        stomak += stek+1;
                        stek = y-1;
                    }
                    prethodni = x;
                }
                if (dan.Count == 0)
                {
                    stomak += Math.Min(trazen - prethodni, stek);
                }
                else
                {
                    if (trazen - prethodni < stek)
                    {
                        stomak += trazen - prethodni;
                        stek = stek - (trazen - prethodni);
                    }
                    else
                    {
                        stomak += stek;
                        stek = 0;
                    }
                    prethodni = trazen;
                }
                Console.WriteLine(stomak);
            }
        }
    }
}