fork download
  1. program pr;
  2. Var
  3. n,k,i,s,q:integer;
  4. a:array[1..100000] of integer;
  5. b:array[1..100000] of integer;
  6. Begin
  7. q:=0;
  8. read(n,k);
  9. for i:=1 to n do
  10. readln(a[i]);
  11. for i:=1 to n do
  12. b[i]:=k-a[i];
  13. for i:=1 to n do begin
  14. if b[i]<0 then s:=abs(b[i]);
  15. if b[i]>=0 then q:=q+b[i] ;
  16. end;
  17.  
  18. write(s,' ',q)
  19. End.
  20.  
Success #stdin #stdout 0s 728KB
stdin
4 5
2 7 5 0
stdout
0 18