read x a
read c
d=(`echo $c`)
echo ${d[@]} | sed 's/\s/\n/g' | sort > t
e=`cat t | uniq | wc -l`
f=(`cat t | uniq -c | sort -n`)
z=0

if [ $e -ge $a ];then
    g=$(($e - $a))
    for ((i=0;i < $x;i+=2));do
        if [ $g -gt 0 ];then
            z=$((z + ${f[i]}))
            g=$((--g))
        fi
    done
fi
echo $z