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

namespace Cale___Plazma___takmicenje
{
    class Program
    {
        struct plazma
        {
            public int dan;
            public int brp;
        }
        static int resenje(int[] a,int[] b, plazma[] n, int i)
        {
            int d1 = a[i];
            int l = 0;
            for (int j = 0; j <= d1; j++)
            {
                if (b[j] == 1) l++;
            }
            return l;
        }
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split();
            int N = int.Parse(s1[0]);
            int Q = int.Parse(s1[1]);
            plazma[] n = new plazma[N];
            string[] s2;
            for (int i = 0; i < N; i++)
            {
                s2 = Console.ReadLine().Split();
                n[i].dan = int.Parse(s2[0]);
                n[i].brp = int.Parse(s2[1]);
            }
            int[] a = new int[Q];
            for (int i = 0; i < Q; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }

            int[] b = new int[(int)Math.Pow(10, 5)];
            for (int i = 0; i < n.Length; i++)
            {
                int l = n[i].dan;
                for (int j = n[i].brp; j >0 ;)
                {
                    if (b[l] == 0)
                    {
                        b[l] = 1;
                        j--;
                    }
                    l++;
                }
            }

            for (int i = 0; i < Q; i++)
            {
                Console.WriteLine(resenje(a, b, n ,i));
            }
            Console.ReadLine();
        }
    }
}