using System;
class Program
{
    static void Main(string[] args)
    {
        string[] unos = Console.ReadLine().Split();
        int n = int.Parse(unos[0]);
        int q = int.Parse(unos[1]);
        Dictionary<long, long> plazma = new Dictionary<long, long>();
        long[] pinit = new long[n]; 
        for (int i = 0; i < n; i++)
        {
            unos = Console.ReadLine().Split();
            plazma.Add(long.Parse(unos[0]), long.Parse(unos[1]));
            pinit[i]=long.Parse(unos[1]);
        }
        long[] odg = new long[q];
        for (int j = 0; j < q; j++)
        {
            long k = long.Parse(Console.ReadLine());
            if (k < plazma.ElementAt(0).Key) odg[j] = 0;
            else
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (k > plazma.ElementAt(i + 1).Key)
                    {
                        if (plazma.ElementAt(i + 1).Key - plazma.ElementAt(i).Key + 1 <= plazma.ElementAt(i).Value)
                        {
                            odg[j] += plazma.ElementAt(i + 1).Key - plazma.ElementAt(i).Key + 1;
                            plazma[plazma.ElementAt(i + 1).Key] += plazma.ElementAt(i).Value - (plazma.ElementAt(i + 1).Key - plazma.ElementAt(i).Key + 1);
                        }
                        else odg[j] += plazma.ElementAt(i).Value;
                    }
                    else
                    {
                        if ((k - plazma.ElementAt(i).Key + 1) <= plazma.ElementAt(i).Value)
                        {
                            odg[j] += k - plazma.ElementAt(i).Key + 1;
                            plazma[plazma.ElementAt(i+1).Key] += plazma.ElementAt(i).Value - (k - plazma.ElementAt(i).Key + 1);
                        }
                        else odg[j] += plazma.ElementAt(i).Value;
                        break;
                    }
                }
                if (plazma.Last().Key < k)
                {
                    odg[j] += (k - plazma.Last().Key + 1) <= plazma.Last().Value ? k - plazma.Last().Key + 1 : plazma.Last().Value;
                }
            }
            for (int i = 0; i < n; i++)
                plazma[plazma.ElementAt(i).Key]=pinit[i];
        }
        foreach (long o in odg)
            Console.WriteLine(o);
    }
}