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

namespace ConsoleApp3
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long n = long.Parse(s[0]);
            long q = long.Parse(s[1]);
            long[] dani = new long[n];
            long[] pr = new long[n];
            long zbir = 0;
            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                dani[i] = long.Parse(s[0]);
                pr[i] = long.Parse(s[1]);
            }
            for (long i = 0; i < q; i++)
            {
                long upit = long.Parse(Console.ReadLine());
                zbir = 0;
                for (long j = 0; j < n; j++)
                {
                    if (dani[j] + pr[j] <= upit)
                    {
                        zbir += pr[j];
                    }
                    else if (dani[j] <= upit)
                    {
                        zbir += Math.Min(pr[j], upit - dani[j] + 1);
                    }
                    else
                    {
                        break;
                    }
                }
                Console.WriteLine(zbir);
            }


        }
    }
}