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

namespace ConsoleApplication1
{
    class Program
    {
        static int BestMove(int currentMove, int[] d, int[] p, int totalP, int Health, int N)
        {
            if (Health - (d[currentMove] + totalP) <= 0)
            {
                return currentMove + 1;
            }
            else if (Health - (p[currentMove] + totalP) <= 0)
            {
                return currentMove + 1;
            }
            else if(currentMove + 2 < N)
            {
                totalP += p[currentMove];
                Health -= (p[currentMove] + totalP);
                return BestMove(currentMove + 1, d, p, totalP,  Health, N);
            }
            else
                return -1;
        }
        static void Main(string[] args)
        {
            string[] NQ = Console.ReadLine().Split();
            int N = int.Parse(NQ[0]);
            int Q = int.Parse(NQ[1]);
            int[] D = new int[N];
            int[] P = new int[N];
            int[] answers = new int[Q];
            for (int i = 0; i < N; i++)
            {
                string[] DP = Console.ReadLine().Split();
                D[i] = int.Parse(DP[0]);
                P[i] = int.Parse(DP[1]);
            }
            for (int i = 0; i < Q; i++)
            {
                int H = int.Parse(Console.ReadLine());
                answers[i] = BestMove(0, D, P, 0, H, N);
            }
            for (int i = 0; i < Q; i++)
            {
                Console.WriteLine(answers[i]);
            }

        }
    }
}