using System;
internal class Program
    {
        static void Main(string[] args)
        {
            string[] l1 = Console.ReadLine().Split(" ");
            int n = int.Parse(l1[0]);
            int q = int.Parse(l1[1]);

            long[] dan = new long[n];
            long[] plazma = new long[n];
            long[] pitanje = new long[q]; 
            for (int i = 0; i < n; i++)
            {
                string[] l = Console.ReadLine().Split(" ");
                dan[i] = (long)int.Parse(l[0]);
                plazma[i] = (long)int.Parse(l[1]);
            }

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

            for (int i = 0; i < q; i++)
            {
                long kraj = pitanje[i];
                long stek = 0;
                long nasao = 0;
                long pojela = 0;
                for (long j = 1; j <= kraj; j++)
                {
                    if (dan[nasao] == j)
                    {
                        stek += plazma[nasao];
                        if(nasao != n - 1)
                        {
                            nasao++;
                        }
                    }
                    if(stek > 0)
                    {
                        pojela += 1;
                        stek -= 1;
                    }
                    if (j == dan[nasao] + 1)
                    {
                        if(stek > kraj - j)
                        {
                            pojela += kraj - j;
                        }
                        else
                        {
                            pojela += stek;
                        }
                        break;
                    }
                }
                Console.WriteLine(pojela);
            }
        }
    }