program plazma;

var n, q :longint;
    d :array[1..300000, 1..2] of int64;
    k :array[1..300000] of int64;
    i, f :longint;
    zbir :int64;

begin
read(n);
read(q);
for i := 1 to n do 
    begin
    read(d[i, 1]);
    read(d[i, 2]);
    end;
for i := 1 to q do
    readln(k[i]);
for i := 1 to q do
    begin
    zbir := 0;
    if k[i] < d[1,1] then
        writeln(zbir)
    else
        begin
        f := 1;
        while (k[i] >= d[f, 1]) and (f <= n) do
            begin
            if k[i]-d[f,1]+1 <= d[f, 2] then
                zbir := zbir + (k[i]-d[f,1]+1)
            else
                zbir := zbir + d[f, 2];
            inc(f);
            end;
        writeln(zbir);
        end;
    end;
end.