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

namespace ConsoleApp12
{
    internal class Program
    {
        static long ukupno(long j, long[] d, long[] p)
        {
            long s = 0;
            for(int i = 0; i < d.Length;i++)
            {
                if (d[i] <= j)
                {
                    long r = j - d[i]+1;
                    if (s < j)
                    {
                        if (r >= p[i])
                            s += p[i];
                        else
                            s += r;
                    }
                }
            }
            return s;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]);
            int q = int.Parse(s[1]);
            long[] d = new long[n];
            long[] p = new long[n];
            for (int i = 0; i < n; i++)
            {
                string[] s1 = Console.ReadLine().Split(' ');
                d[i] = long.Parse(s1[0]);
                p[i] = long.Parse(s1[1]);                         
            }
            long[] b = new long[q];
            for (int j = 0; j < q; j++)
                b[j] = long.Parse(Console.ReadLine());
            for(int j = 0; j < q; j++)
            {
                long uk = ukupno(b[j], d, p);
                Console.WriteLine(uk);
            }
            Console.ReadLine();
        }
    }
}