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

namespace ConsoleApp3
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long n = long.Parse(s[0]);
            long q = long.Parse(s[1]);
            long[] dani = new long[n];
            long[] pr = new long[n];
            for (int i = 0; i < n; i++)
            {
                s= Console.ReadLine().Split();
                dani[i] = long.Parse(s[0]);
                pr[i]= long.Parse(s[1]);
            }
            long k = 1;
            for (long i = 0;i < q; i++)
            {
                long upit = long.Parse(Console.ReadLine());
                long ostatak = pr[0];
                long z = 0;

                for (long j = dani[0]; j <= upit; j++)
                {
                    if (k < n && dani[k] == j)
                    {
                        ostatak += pr[k];
                        k++;
                    }
                    if (ostatak >= 1)
                    {
                        z++;
                        ostatak--;                       
                    }
                    
                    if (k == n && ostatak == 0)
                    {
                        break;
                    }

                }
                Console.WriteLine(z);
                
            }


        }
    }
}