using System;
using System.ComponentModel.Design;
using System.Linq.Expressions;

class Program
{
    static void Main()
    {
        string[] pl = Console.ReadLine().Split(' ');
        int N = int.Parse(pl[0]);
        int Q = int.Parse(pl[1]);
        string[] linija = new string[2];
        long p, bp, d, k, sum, razlika;
        long[] dani = new long[N];
        long[] plazma = new long[N];
        long[] pitanja = new long[Q];
        bp = 0;
        sum = 0;
        razlika = 0;
        int x = 0;
        for (long i = 0; i < N; i++)
        {
            linija = Console.ReadLine().Split(' ');
            d = long.Parse(linija[0]);
            p = long.Parse(linija[1]);
            dani[i] = d;
            plazma[i] = p;
            bp = bp + p;
        }
        for (long i = 0; i < Q; i++)
        {
            k = long.Parse(Console.ReadLine());
            pitanja[i] = k;
        }
        for (long y = 0; y < Q; y++)
        {
            sum = plazma[0];
            razlika = 0;
            for (long i = 1; i < pitanja[y]; i++)
            {
                if (i < N && pitanja[y] >= dani[N - 1] + plazma[N - 1])
                {
                    sum = sum + plazma[i];
                    x = 4;
                }
                else if (i < N && pitanja[y] >= dani[N - 1])
                {
                    if (sum >= dani[i])
                    {
                        sum = sum + dani[i];
                    }
                    else
                    {
                        razlika = razlika + dani[i] - sum - 1;
                        sum = sum + plazma[i];
                        x = 2;
                    }
                }
                else if (i < N && pitanja[y] >= dani[0])
                {
                    if (sum >= dani[i])
                        sum = sum + dani[i];
                    else
                    {
                        razlika = razlika + 1;
                        x = 1;
                    }
                }
                else if (i < N && pitanja[y] < dani[0])
                {
                    x = 3;
                    break;
                }
                else
                {
                    break;
                }
            }
            switch (x)
            {
                case 1:
                    Console.WriteLine(pitanja[y] - razlika-1);
                    break;
                case 2:
                    Console.WriteLine(pitanja[y] - razlika);
                    break;
                case 3:
                    Console.WriteLine(razlika);
                    break;
                case 4:
                    Console.WriteLine(sum);
                    break;
            }

        }
        

    }
}