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

namespace zad2
{
    internal class Program
    {
        struct x
        {
            public int dan;
            public int plazma;
        }
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split();
            int N = int.Parse(s1[0]);
            int Q = int.Parse(s1[1]);
            x[] a = new x[N];
            for (int i = 0; i < N; i++)
            {
                string[] s2=Console.ReadLine().Split();
                a[i].dan = int.Parse(s2[0]);
                a[i].plazma= int.Parse(s2[1]);
            }
            int[]q=new int[Q];
            for (int i = 0; i < Q; i++)
            {
                q[i] = int.Parse(Console.ReadLine());

            }
            int k = 0;
            int brp = 0;
            int l = 0;
            int ukzalihe = 0;

            int[] nizbrp = new int[Q];
            
            for (int i = 0; i < Q; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (q[i] >= a[j].dan) k = j;
                }
                while (l<k)
                {
                    ukzalihe += a[l].plazma;
                    brp += Math.Min(a[l + 1].dan - a[l].dan+1, ukzalihe);
                    ukzalihe-= Math.Min(a[l + 1].dan - a[l].dan + 1, ukzalihe);
                    l++;
                }
                ukzalihe += a[k].plazma;
                brp += Math.Min(q[i] - a[k].dan+1, ukzalihe);
                nizbrp[i] = brp;
            }
            for (int i = 0; i < Q; i++)
            {
                Console.WriteLine(brp);
            }
            
            
        }
    }
}