use strict; use warnings; sub gets { chomp(my $line = <>); $line; } my ($n, $m) = split / /, gets; my @a = split / /, gets; my %h = map {$_, 1} @a; my $max = keys(%h); print $max==1 ? "$max $max\n" : "$max 0\n";