The marmots have prepared a very easy problem for this year's HC^2 – this one. It involves numbers n, k and a sequence of n positive integers a_1, a_2, ..., a_{n}. They also came up with a beautiful and riveting story for the problem statement. It explains what the input means, what the program should output, and it also reads like a good criminal.

However I, Heidi, will have none of that. As my joke for today, I am removing the story from the statement and replacing it with these two unhelpful paragraphs. Now solve the problem, fools!


-----Input-----

The first line of the input contains two space-separated integers n and k (1 ≤ k ≤ n ≤ 2200). The second line contains n space-separated integers a_1, ..., a_{n} (1 ≤ a_{i} ≤ 10^4).


-----Output-----

Output one number.


-----Examples-----
Input
8 5
1 1 1 1 1 1 1 1

Output
5
Input
10 3
16 8 2 4 512 256 32 128 64 1

Output
7
Input
5 1
20 10 50 30 46

Output
10
Input
6 6
6 6 6 6 6 6

Output
36
Input
1 1
100

Output
100

Difficulty: interview

Starter code:

Solutions:
import sys

n_k = [int(x) for x in sys.stdin.readline().split()]
k = n_k[1]
a = [int(x) for x in sys.stdin.readline().split()]

# sum of k smallest numbers
a = sorted(a)
k_smallest = sum(a[:k])

print(k_smallest)


import sys

def solve():
    n, k = map(int, input().split())
    a = [int(i) for i in input().split()]
    a.sort()
    ans = sum(a[:k])
    print(ans)
    
def __starting_point():
    solve()
__starting_point()

n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a = sorted(a)
ans = sum(a[:k])
print(ans)



n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
o = 0
for i in range(m):
    o += a[i]
print(o)


n,k = (int(x) for x in input().split(' '))
a = [int(x) for x in input().split(' ')]
a.sort()
ans = sum(a[0:k])
print(ans)

n,k=input().strip().split(' ')
n,k=(int(n),int(k))
l=list(map(int,input().strip().split(' ')))
l.sort()
print(sum(l[:min(k,n)]))

n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
s = 0

for i in range(k):
    s += a[i]

print(s)


n, k=map (int, input (). split ()) 
a=list (map (int, input (). split ())) 
a=sorted (a) 
ans=0
for i in range (min(k, n) ):
    ans+=a[i] 
print (ans) 

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
print(sum(a[:k]))


nAndk = input().split()
n, k = [int(i) for i in nAndk]

inp = input().split()
num = [int(i) for i in inp]
num.sort()

ans = num[:k]
print (sum(ans))

# -*-coding: utf-8 -*-

# Inicio del Programa
n, k = [int(x) for x in input().split()]
numeros = [int(x) for x in input().split()]

numeros.sort()
suma = sum(numeros[:k])
print(suma)


n,k=list(map(int, input().split()))
a=sorted([int(i) for i in input().split()])
s=0
for i in range(k):
    s+=a[i]
print(s)



# -*-coding: utf-8 -*-
from sys import stdin
for line in stdin:
    entrada = line.splitlines()
    break
n=int(entrada[0].split()[0])
k=int(entrada[0].split()[1])
numeros = [int(x) for x in input().split()]
numeros.sort()
suma = sum(numeros[:k])
print(suma)


# -*- coding: utf-8 -*-
from sys import stdin
entrada=0

sumatotal=0


for line in stdin:
    linea1 = line.splitlines()
    break


a = int(linea1[0].split()[0])
b = int(linea1[0].split()[1])

arreglo=[]

for x in input().split():
	arreglo.append(int(x))




arreglo.sort();
sumatotal=sum(arreglo[:b])
   

print(sumatotal)

n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
print (sum(a[:k]))

R=lambda:list(map(int,input().split()))
n,k=R()
print(sum(sorted(R())[:k]))


n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
print(sum(a[:k]))

n,k=map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:k]))

3
n,k = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))

a.sort()
print(sum(a[i] for i in range(k)))


n, k = map(int, input().split())
a = list(map(int, input().split()))
print(sum(sorted(a)[:k]))

n,k=input().split()
k=int(k)
l=list(map(int,input().split()))
l.sort()
sum=0
for i in range(0,k):
    sum+=l[i]
print(sum)

n,k=map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:k]))

a,b=input().strip().split(' ')
a,b=int(a),int(b)
l=list(map(int,input().strip().split(' ')))
l=sorted(l)
print(sum(l[:b]))

R=lambda:list(map(int,input().split()))
n,k=R()
print(sum(sorted(R())[:k]))

#!/usr/bin/env python3

firstLine = [int(x) for x in input().split()]
secondLine = [int(x) for x in input().split()]

print(sum(sorted(secondLine)[:firstLine[1]]))