program prijatelji;
var n,m,i,j,sum:integer;
x,y,br,a:array[1..100000] of integer;

begin
read(n,m);
for i:=1 to n do
readln(a[i]);
for i:=1 to m do
readln(x[i],y[i]);
for i:=1 to n do
begin
br[i]:=0;
for j:=1 to m do
begin
if x[j]=i then br[i]:=br[i]+1;
if y[j]=i then br[i]:=br[i]+1;
end;
end;
sum:=0;
for i:=1 to n do
sum:=sum+br[i];
write(sum);
end.