using System;
using System.Linq;

namespace takmicenje2
{
    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[] dan = new long[n];
            long[] plazme = new long[n];
            for (int i = 0; i < n; i++)
            {
                s = Console.ReadLine().Split();
                dan[i] = long.Parse(s[0]);
                plazme[i] = long.Parse(s[1]);
            }
            for (long i = 0; i < q; i++)
            {
                long k = long.Parse(Console.ReadLine());
                long skobo = 0;
                for (long j = 0; j < n; j++)
                {
                    if (dan[j] + plazme[j] <= k)
                    {
                        skobo += plazme[j];
                    }
                    else if (dan[j] <= k)
                    {
                        if (plazme[j] < k - dan[j] + 1)
                            skobo += plazme[j];
                        else
                            skobo += k - dan[j] + 1;
                    }
                    else
                    {
                        break;
                    }
                }
                Console.WriteLine(skobo);
            }

        }
    }
}