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

namespace drugi
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] info = Console.ReadLine().Split(' ');
            int n = int.Parse(info[0]);
            int q = int.Parse(info[1]);
            long[,] plazma = new long[n, 2];
            for (int i = 0; i < n; i++)
            {
                info = Console.ReadLine().Split();
                plazma[i, 0] = long.Parse(info[0]);
                plazma[i, 1] = long.Parse(info[1]);
            }
            long dan = 0;
            long visak = 0;
            long pojedeno = 0;
            int brojac = 0;
            for (int i = 0; i < q; i++)
            {
                long k = long.Parse(Console.ReadLine());
                while (brojac < n && plazma[brojac, 0] < k) 
                {
                    pojedeno += Math.Min(visak, plazma[brojac, 0] - dan);
                    visak = Math.Max(0, visak - (plazma[brojac, 0] - dan)) + plazma[brojac, 1];
                    dan = plazma[brojac++, 0];
                }
                pojedeno += Math.Min(visak, k - dan);
                visak = Math.Max(0, visak - (k - dan));
                dan = k;
                if (visak > 0) Console.WriteLine(pojedeno + 1);
                else Console.WriteLine(pojedeno);
            }
        }
    }
}