using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Schema;

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