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

namespace Plazma
{
    internal class Program
    {
        static long Pojedena(long[,]a,long upit,long n)
        {
            long i = 0;
            long s = 0;
            while(i<n && a[i, 0] < upit)
            {
                if (s + a[0,0]+ a[i, 1] > upit)
                {
                    return s + upit - a[i, 0] + 1;
                }
                s += a[i, 1];
                i++;
            }
            return s;
        }
        static void Main(string[] args)
        {
            string []unos1 = Console.ReadLine().Split();
            long n=int.Parse(unos1[0]),q = long.Parse(unos1[1]);
            long[,] a = new long[n, 2];
            long[] izlaz = new long[q];
            for(int i=0;i<n;i++)
            {
                unos1 = Console.ReadLine().Split();
                a[i, 0] = long.Parse(unos1[0]);
                a[i, 1] = long.Parse(unos1[1]);
            }
            for(int i=0;i<q;i++)
            {
                izlaz[i]=Pojedena(a, long.Parse(Console.ReadLine()), n);             
            }
            for (int i = 0; i < q; i++)
            {
                Console.WriteLine(izlaz[i] + " ");
            }
            Console.ReadLine();
        }
    }
}