using System;

class Program
{
    static void Main()
    {
        var ulaz1 = Console.ReadLine().Split();
        long n = long.Parse(ulaz1[0]);
        long q = long.Parse(ulaz1[1]);
        
        long[] nizd = new long[n];
        long[] nizp = new long[n];
        
        for (long i = 0; i < n; i++)
        {
            var ulaz2 = Console.ReadLine().Split();
            long d = long.Parse(ulaz2[0]);
            long p = long.Parse(ulaz2[1]);
            nizd[i] = d;
            nizp[i] = p;
        }

        long[] nizq = new long[q];
        for (long j = 0; j < q; j++)
        {
            nizq[j] = long.Parse(Console.ReadLine());
        }

        long brojac = 0;

        if (q == 1)
        {
            for (long k = 0; k < n; k++)
            {
                if (nizp[k] >= nizd[k] - (k > 0 ? nizd[k - 1] : 0) && nizq[0] > nizd[k] && nizq[0] >= nizp[k])
                {
                    brojac = nizp[k] + brojac;
                }
                else if (nizp[k] >= nizd[k] - (k > 0 ? nizd[k - 1] : 0) && nizq[0] > nizd[k] && nizq[0] < nizp[k])
                {
                    brojac = brojac + nizq[0] - nizd[k];
                }
            }
        }

        Console.WriteLine(brojac);
    }
}