using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlTypes;
using System.IO;
using System.Linq;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;

namespace zadatak
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int maxN = 300005;
            string[] input = Console.ReadLine().Split();
            int n = int.Parse(input[0]);
            int q = int.Parse(input[1]);
            long[] dani = new long[maxN];
            long[] plazma = new long[maxN];
            dani[0] = 0;
            plazma[0] = 0;
            for (int i = 1; i <= n; i++)
            {
                input = Console.ReadLine().Split();
                dani[i] = int.Parse(input[0]);
                plazma[i] = int.Parse(input[1]);

            }

            long[] brPlazmi = new long[maxN];
            long visak = 0;
            brPlazmi[0] = 0;
            for (int i = 1; i <= n; i++)
            {
                brPlazmi[i] = brPlazmi[i - 1];
                long razlika = dani[i] - dani[i - 1];
                if (razlika >= plazma[i - 1])
                {
                    brPlazmi[i] += plazma[i - 1];

                }
                else
                {
                    brPlazmi[i] += razlika;
                    visak = plazma[i - 1] - razlika;
                }
                plazma[i] += visak;
                visak = 0;
                if (plazma[i] > 0)
                {
                    brPlazmi[i]++;
                    plazma[i]--;
                }

            }



            for (int i = 0; i < q; i++)
            {
                
                long k = long.Parse(Console.ReadLine());

                if (k < dani[1])
                    Console.WriteLine(0);
                else
                {
                    long najblizeK = 0;
                    while (dani[najblizeK] <= k && najblizeK <= n)
                        najblizeK++;
                    najblizeK--;

                    long r =  brPlazmi[najblizeK];
                    long razlika = k - dani[najblizeK];
                    if (razlika >= plazma[najblizeK])
                    {
                        r += plazma[najblizeK];
                    }
                    else
                    {
                        r += razlika;
                        visak = plazma[najblizeK] - razlika;
                    }
                    plazma[i] += visak;
                    visak = 0;
                    
                    Console.WriteLine(r);
                }
            }

        }
    }
}