using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            string[] b = Console.ReadLine().Split();
            int n = int.Parse(b[0]);
            int m = int.Parse(b[1]);
            long[] x = new long[n];
            long[] y = new long[n];
            long[] k = new long[m];
            long a = 0;
            for (int i = 0; i < n; i++)
            {
                string[] c = Console.ReadLine().Split();
                x[i] = long.Parse(c[0]);
                y[i] = long.Parse(c[1]);
            }
            for (int i = 0; i < m; i++)
            {
                k[i] = long.Parse(Console.ReadLine());
            }
            for (int l = 0; l < m; l++)
            {
                long t = 0;
                for (int i = 0; i < n; i++)
                {
                    if (x[i] <= k[l]+1)
                    {
                        a = Math.Min(y[i], k[l] - x[i] + 1);
                        t += a;
                        x[i] += a;
                    }
                }
                Console.WriteLine(t);
            }
        }
    }
}