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

namespace ConsoleApp4
{
    internal class Program
    {
        static long Plazma(long[] d, long[] p, long pitanje, long N)
        {
            long sum = 0;
            if (d[0] > pitanje) return sum;
            for(int i = 0; i < d.Length; i++)
            {
                    if (d[i] + p[i] >= pitanje && d[i] < pitanje)
                    {
                        sum += pitanje - d[i];
                        Console.WriteLine("IF, i = " + i + "/ " + sum + " = " + pitanje + " - " + d[i]);
                        return sum + 1;
                    }
                    else
                    {
                        sum += p[i];
                        Console.WriteLine("ELSE, i = " + i + "/ " + sum + " += " + p[i]);
                }
            }
            Console.WriteLine("FIN = " + sum);
            return sum;
        }

        static void Main()
        {
            string[] s = Console.ReadLine().Split();
            long N = long.Parse(s[0]);
            long Q = long.Parse(s[1]);

            long[] d = new long[N];
            long[] p = new long[N];
            long[] pitanja = new long[Q];

            for (long i = 0; i < N; i++)
            {
                s = Console.ReadLine().Split();
                d[i] = long.Parse(s[0]);
                p[i] = long.Parse(s[1]);
            }

            for (long i = 0; i < Q; i++)
            {
                pitanja[i] = long.Parse(Console.ReadLine());
            }

            for (long i = 0; i < pitanja.Length; i++)
            {
                Console.WriteLine(Plazma(d, p, pitanja[i], N));
            }
        }
    }

}