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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] c = Console.ReadLine().Split(' ');
            string cs;
            long n = Convert.ToInt64(c[0]), q = Convert.ToInt64(c[1]),b,z,p;
            long[,] a= new long[n,2];
            long[] rez = new long[q];
            for (int i = 0; i < n; i++)
            {
                c = Console.ReadLine().Split(' ');
                a[i, 0]= Convert.ToInt64(c[0]);
                a[i, 1]= Convert.ToInt64(c[1]);
            }
            for(int i = 0; i < q; i++)
            {
                cs = Console.ReadLine();
                z = 0;
                p = 0;
                b = 0;
                for (int j = 0; j < Convert.ToInt64(cs); j++)
                {
                    if (b < n && a[b, 0] == j+1)
                        z += a[b++, 1];
                    if (b == n)
                    {
                        if (z - a[b - 1, 0] < Convert.ToInt64(cs))
                            p += z;
                        else
                            p += (Convert.ToInt64(cs) - a[b - 1, 0]);
                        break;
                    }
                    if (z > 0)
                    {
                        p++;
                        z--;
                    }
                }
                rez[i]= p;
            }
            foreach (long x in rez)
                Console.WriteLine(x);
        }
    }
}