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]);

        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;
                continue;
            }
            int ls = 0, ds = n - 1;
            while (ls < ds)
            {
                int sr = ls + (ds - ls + 1) / 2;
                if (d[sr] <= k)
                    ls = sr;
                else
                    ds = sr - 1;
            }
            for (int i = 0; i < ls; i++)
            {
                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];
            }
            if ((k - d[ls] + 1) <= p[ls])
                odg[j] += k - d[ls] + 1;
            else
                odg[j]+= p[ls];
            Array.Copy(pinit, p, n);
        }
        foreach (long o in odg)
            Console.WriteLine(o);
    }
}