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

namespace ConsoleApp90
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int N = Convert.ToInt32(s[0]); int Q = Convert.ToInt32(s[1]);
            int[] d = new int[N]; int[] p = new int[N];
            for (int m = 0; m < N; m++) 
            {
                s = Console.ReadLine().Split(' ');
                d[m] = Convert.ToInt32(s[0]); p[m] = Convert.ToInt32(s[1]);
            }
            int[] k = new int[Q];
            for (int m = 0; m < Q; m++) 
            {
                k[m] = int.Parse(Console.ReadLine());
            }
            int i = 0;
            int j = 0;
            int plazma = 0;
            int pojedena_plazma = 0;
            int dan_pre = 0;
            int dan_posle = 0;
            while (j < Q && i < N)
            {
                if (i - 1 != -1) { dan_pre = d[i - 1]; }
                if (i + 1 != N) { dan_posle = d[i + 1]; }
                if (dan_posle < k[j])
                {
                    plazma += p[i];
                    if (plazma < (dan_posle - d[i])) { pojedena_plazma += plazma; plazma = 0; }
                    else { pojedena_plazma += (dan_posle - d[i]); plazma -= (dan_posle - d[i]); }
                    i++;
                }
                else 
                {
                    if (plazma < (k[i] - d[i])) { pojedena_plazma += plazma; plazma = 0; }
                    else { pojedena_plazma = (k[i] - d[i]); plazma -= (k[i] - d[i]); }
                    Console.WriteLine(pojedena_plazma + 1);
                    pojedena_plazma = 0;
                    j++;
                }
            }
            Console.ReadLine();
        }
    }
}