read x a
read c
d=(`echo $c`)
IFS=$'\n'
echo "${d[*]}" | sort > t
e=`cat t | uniq | wc -l`
f=(`cat t | uniq -c | sort -n`)
z=0
IFS=$' '
if [ $e -ge $a ];then
    g=$(($e - $a))
    for ((i=0;i < $x;i+=2));do
        if [ $g -gt 0 ];then
            h=(${f[i]})
            z=$((z + $h))
            g=$((--g))
        fi
    done
fi
echo $z