const
  MaxN = 100010;
  MaxM = 100010;

type
  Point = Record
    x : longint;
    t : longint;
    num : longint;
  end;

var
  a : array[0..2*MaxN + MaxM] of Point;
  sol : array[0..MaxM] of longint;
  n, m, i, sum : longint;
  x, y : Point;


procedure QS(l, r : longint);
var
  i, j: longint;
begin
  i := l; j := r; x := a[(l + r) DIV 2];
  repeat
    while ((a[i].x < x.x) or ((a[i].x = x.x) and (a[i].t > x.t))) do i := i + 1;
    while ((x.x < a[j].x) or ((x.x = a[j].x) and (x.t > a[j].t))) do j := j - 1;
    if (i <= j) then begin
      y := a[i]; a[i] := a[j]; a[j] := y;
      i := i + 1; j := j - 1;
    end;
  until (i > j);
  if (l < j) then QS(l, j);
  if (i < r) then QS(i, r);
end;

begin

   readln(n, m);
   for i := 0 to m - 1 do begin
     read(a[i].x);
     a[i].t := 0;
     a[i].num := i;
   end;
   for i := 0 to n - 1 do begin
     readln(a[m + 2*i].x, a[m + 2*i + 1].x);
     a[m + 2*i].t := 1;
     a[m + 2*i + 1].t := -1;
   end;

   QS(0, m + 2 * n - 1);
   sum := 0;
   for i := 0 to m + 2 * n - 1 do begin
     if (a[i].t = 0) then
       sol[ a[i].num ] := sum
     else
       sum := sum + a[i].t;
   end;

   for i := 0 to m - 1 do
     writeln(sol[i]);

end.
