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

        long[] d = new long[n];
        long[] p = new long[n];
        long[] pinit = new long[n];

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

        long[] odg = new long[q];
        for (int j = 0; j < q; j++)
        {
            long k = long.Parse(Console.ReadLine());
            if (k < d[0]) odg[j] = 0;
            else
            {
                for (int i = 0; i < n - 1; i++)
                {
                    if (k > d[i + 1])
                    {
                        if (d[i + 1] - d[i] + 1 <= p[i])
                        {
                            odg[j] += d[i + 1] - d[i] + 1;
                            p[i + 1] += p[i] - (d[i + 1] - d[i] + 1);
                        }
                        else odg[j] += p[i];
                    }
                    else
                    {
                        if ((k - d[i] + 1) <= p[i])
                        {
                            odg[j] += k - d[i] + 1;
                            p[i + 1] += p[i] - (k - d[i] + 1);
                        }
                        else odg[j] += p[i];
                        break;
                    }
                }
                if (d[n - 1] < k)
                    odg[j] += (k - d[n - 1] + 1) <= p[n - 1] ? k - d[n - 1] + 1 : p[n - 1];
            }
            Array.Copy(pinit, p, n);
        }

        foreach (long o in odg)
            Console.WriteLine(o);
    }
}