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

namespace ConsoleApp4
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string k = Console.ReadLine();
            int N = int.Parse(k.Split(' ')[0]);
            int Q = int.Parse(k.Split(' ')[1]);
            string l;
            int[] d = new int[N];
            int[] p = new int[N];
            for (int i = 0;i< N; i++)
            {
                 l= Console.ReadLine();
                d[i] = int.Parse(l.Split(' ')[0]);
                p[i] = int.Parse(l.Split(' ')[1]);   
            }
            int[] e = new int[Q];
            int[] u = new int[Q];
            int h = 0;
            int g = 0;
            int b = 0;
            for(int i = 0;i< Q; i++)
            {
                e[i] = int.Parse(Console.ReadLine());
                for(int j = 0;j< N; j++)
                {
                    if (e[i] > d[j])
                    {
                        h = h + p[j];
                        if (j == 0)
                        {
                            if (d[j] != 1)
                            {
                                g = g + d[j] - 1;
                            }
                        }
                        if (j != N - 1)
                        {
                            if (p[j] < d[j + 1])
                            {
                                g = g + (d[j + 1] - p[j]) - 1;
                            }
                        }
                    }
                    else
                    {
                        b = 1;
                    }
                    
                }
                if (b == 0)
                {
                    u[i] = h - (h - e[i] + g);
                }
                if(b==1)
                {
                    u[i] = 0;
                }


            }
            for(int i = 0;i< Q;i++)
            {
                Console.WriteLine(u[i]);
            }
            Console.Read();
        }
    }
}