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

namespace Plazma
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string input=Console.ReadLine();
            string[] inputs = input.Split(' ');
            int N = int.Parse(inputs[0]);
            int Q = int.Parse(inputs[1]);
            ulong[] d = new ulong[N];
            int[] p = new int[N];
            Dictionary<ulong, int> dp = new Dictionary<ulong, int>();
            ulong[] k=new ulong[Q];
            for (int i = 0; i < N; i++) {
                input=Console.ReadLine();
                inputs = input.Split(' ');
                d[i] = ulong.Parse(inputs[0]);
                p[i] = int.Parse(inputs[1]);
                
                
            }
            
            for (int j = 0; j < Q; j++) {
                k[j] = ulong.Parse(Console.ReadLine());
            }

            ulong deltad;
           
            for (int j = 0; j < Q; j++) {
                ulong consumed = 0;
                ulong backlog=0;
               for(int i = 0; i < N ; i++)
                {

                    
                    
                    if (d[i] <= k[j]+1)
                    {

                        
                        if (i < N-1)
                        {
                             deltad = (Math.Min(d[i + 1], k[j]+1) - d[i]);
                        }
                        else
                        {
                             deltad = (k[j]+1 - d[i]);
                        }
                        if ((ulong)p[i] + backlog > deltad)
                            {
                                consumed += deltad;
                                backlog = backlog + (ulong)p[i] - deltad;
                            }
                            else
                            {
                                consumed += (ulong)p[i] + backlog;
                            }
                        
                       
                        
                    }

                }
                Console.WriteLine(consumed);
                
           }
            
        }
    }
}