read n k a=(`sed -r "s/\-[0-9]+//g" | tr ' ' '\n' | sort -nr | head -$k`) echo $((`echo ${a[@]} | tr ' ' '+'`))