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

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int q = int.Parse(s[1]);

            long[] d = new long[n];
            long[] p = new long[n];
            for (int i = 0; i < n; i++)
            {
                string[] u = Console.ReadLine().Split();
                d[i] = long.Parse(u[0]);
                p[i] = long.Parse(u[1]);
            }

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

            long[] plazme = new long[n];
            plazme[0] = p[0];
            for (int i = 1; i < n; i++)
            {
                plazme[i] = plazme[i - 1] + p[i];
            }

            for (int j = 0; j < q; j++)
            {
                long dan = k[j];
                int l = 0, r = n - 1;
                bool imam = false;
                int indx = -1;

                while (l <= r)
                {
                    int mid = (l + r) / 2;

                    if (d[mid] == dan)
                    {
                        imam = true;
                        indx = mid;
                        break;
                    }
                    if (d[mid] < dan)
                    {
                        l = mid + 1;
                    }
                    else
                    {
                        r = mid - 1;
                    }
                }

                if (!imam)
                {
                    indx = l - 1;
                }

                if (indx < 0)
                {
                    Console.WriteLine(0);
                    continue;
                }

                long ostalo = 0;
                long pojela = 0;
                int posledan = 0;
                for (int i = 0; i <= indx; i++)
                {
                    if (i != 0 && d[i] != d[i - 1] + 1)
                    {
                        long z = d[i] - d[i - 1] - 1;
                        if (z <= ostalo)
                        {
                            ostalo = ostalo - z;
                            pojela = pojela + z;
                        }
                        else
                        {
                            pojela = pojela + ostalo;
                            ostalo = 0;
                        }
                    }

                    ostalo += p[i];
                    ostalo--;
                    pojela++;
                    posledan = i;
                }

                if (ostalo >= dan - d[posledan])
                {
                    pojela += dan - d[posledan];
                }
                else
                {
                    pojela += ostalo;
                }

                Console.WriteLine(pojela);
            }
        }
    }
}