using System;

class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        int N = Convert.ToInt32(s[0]);
        int Q = Convert.ToInt32(s[1]);

        int[] d = new int[N];
        long[] p = new long[N];

        for (int i = 0; i < N; i++)
        {
            string[] input = Console.ReadLine().Split(' ');
            d[i] = Convert.ToInt32(input[0]);
            p[i] = Convert.ToInt64(input[1]);
        }

        long[] q = new long[Q];
        for (int i = 0; i < Q; i++)
        {
            q[i] = Convert.ToInt64(Console.ReadLine());
        }

        for (int i = 0; i < Q; i++)
        {
            long q1 = q[i];
            long a = 0;

            for (int j = 0; j < N; j++)
            {
                if (d[j] <= q1)
                {
                    a += p[j];
                }
                else
                {
                    if (j % 2 == 0)
                    {
                        a += 0;
                    }
                    else
                    {
                        continue;
                    }
                    break;
                }
            }

            Console.WriteLine(a);
        }
    }
}