## Santa and Letters

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

A big part of Santa's day-to-day life is answering letters from children. However, some of these letters are too long and Santa wastes a lot of time reading them. Your next task is to solve this problem for him.

Efficient as always, you hire an elf assistant to screen all of the letters that are currently in Santa's mailbox. The assistant will give the th letter a positive integer score , denoting the amount of time it would take for Santa to read the letter.

After the letters are screened, you decide to only give Santa the shortest letters to read. You must report the total time that Santa will spend reading the letters.

#### Input Specification

The first line will contain two space-separated integers, and .

The next line will contain space-separated integers, .

#### Output Specification

Output one line containing the total time that Santa spends reading the letters if he is given the shortest letters.

#### Sample Input

5 3
1 4 3 10 2

#### Sample Output

6