using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlTypes;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;

namespace zadatak
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int n = int.Parse(input[0]);
            int q = int.Parse(input[1]);
            long[] dani = new long[n];
            int[] plazma = new int[n];
            int maxN = 300002;
            int[] plazmaPojela = new int[maxN];
            int plazmaStek = 0;
            for (int i = 0; i < n; i++)
            {
                input = Console.ReadLine().Split();
                dani[i] = int.Parse(input[0]);
                plazma[i] = int.Parse(input[1]);
            }
            int j = 0;
            plazmaPojela[0] = 0;
            for (int i = 1; i <= maxN - 1; i++)
            {
                if(j < n)
                    if (i == dani[j])
                    {
                        plazmaStek += plazma[j];
                        j++;
                    }
                if (plazmaStek > 0)
                {
                    plazmaPojela[i] = plazmaPojela[i - 1] + 1;
                    plazmaStek--;
                }
                else
                    plazmaPojela[i] = plazmaPojela[i - 1];
            }

            for (int i = 0; i < q; i++)
            {
                long k = long.Parse(Console.ReadLine());
                Console.WriteLine(plazmaPojela[k]);
            }


        }
    }
}