what mistake?

Posted by

Evgenii 13 Jun 2017 12:36

program pr;

Var

n,k,i,s,q:integer;

a:array[1..100000] of integer;

b:array[1..100000] of integer;

Begin

q:=0;

read(n,k);

for i:=1 to n do

readln(a[i]);

for i:=1 to n do

b[i]:=k-a[i];

for i:=1 to n do begin

if b[i]<0 then s:=abs(b[i]);

if b[i]>=0 then q:=q+b[i] ;

end;

write(s,' ',q)

End.