using System;
using System.Collections.Generic;

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,p=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 - p <= stek){
                        stomak += x - p;
                        stek = y+stek-(x - p);
                    }
                    else{
                        stomak += stek+1;
                        stek = y-1;
                    }
                    p = x;
                }
                if (dan.Count == 0){
                    y = Math.Min(trazen - p, stek);
                    stomak += y;
                    stek -= y;
                }
                else{
                    if (trazen - p <= stek){
                        stomak += trazen - p;
                        stek = stek - (trazen - p);
                    }
                    else{
                        stomak += stek;
                        stek = 0;
                    }
                    p = trazen;
                }
                Console.WriteLine(stomak);
            }
        }
    }
}