using System;
public class Zadatak1
{
    public struct Plazma 
    {
        public long dani;
        public long pakovanja;
    }

    public static void Main(string[] args)
    {
        string[] a = Console.ReadLine().Split();

        long n = long.Parse(a[0]);
        long q = long.Parse(a[1]);

        Plazma[] plazma = new Plazma[n];

        for(int i = 0; i < n; i++)
        {
            string[] b = Console.ReadLine().Split();

            plazma[i].dani = long.Parse(b[0]);
            plazma[i].pakovanja = long.Parse(b[1]);
        }

        long[] pitanja = new long[q];

        for (int i = 0; i < q; i++) 
        {
            long x = long.Parse(Console.ReadLine());          
            for (int j = 0; j < n; j++) 
            {
                if (x > plazma[j].dani)
                {
                    if (x - plazma[j].dani > plazma[j].pakovanja)
                    {
                        pitanja[i] += plazma[j].pakovanja;
                    }

                    else

                    {
                        pitanja[i] = pitanja[i] + x - plazma[j].dani + 1;
                        break;
                    }
                }

                else if (x == plazma[j].dani)
                {
                    pitanja[i]++;
                    break;
                }

                else break;

            }
            
        }

        for (int i = 0; i < q; i++) 
        {
            Console.WriteLine(pitanja[i]);
        }

    }
}