Problem:
 Score : 200 points    Problem Statement A shop sells N kinds of fruits, Fruit 1, \ldots, N , at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.      Constraints  1 \leq K \leq N \leq 1000  1 \leq p_i \leq 1000  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  K  p_1  p_2  \ldots  p_N       Output Print an integer representing the minimum possible total price of fruits.        Sample Input 1 5 3
50 100 80 120 80      Sample Output 1 210  This shop sells Fruit 1 , 2 , 3 , 4 , and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.  The minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1 , 3 , and 5 .       Sample Input 2 1 1
1000      Sample Output 2 1000

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()

print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
prices = list(map(int, input().split()))

prices.sort()

print(sum(prices[:K]))

Solution (Python):
N, K = map(int, input().split())
list = list(map(int, input().split()))

list.sort()
i=0
res=0

while(i<K):
  res+=list[i]
  i+=1

print(res)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

sum = 0
for i in p[:k]:
    sum += i
print(sum)

Solution (Python):
a = list(map(int,input().split()))
p = list(map(int,input().split()))
n = a[0]
k = a[1]
answer = 0
p.sort()
for i in range(k):
  answer= answer+p[i]
print(answer)

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

Solution (Python):
n, k = map(int, input().split())
lst = list(map(int, input().split()))
lst = sorted(lst)
ans = 0

for i in range(k):
  ans += lst[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
ans = sum(p[:k])

print(ans)

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

Solution (Python):
N,K = map(int,input().split())
P = [int(i) for i in input().split()]
P.sort()
ans = 0
for i in P[:K]:
    ans += i
print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def main():
    n, k = map(int, input().split())
    p = [int(i) for i in input().split()]
    p.sort()
    ans = sum(p[:k])
    print(ans)
if __name__ == '__main__':
    main()

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

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = sum(p[:k])
print(ans)

Solution (Python):
n, k = list(map(int, input().split(' ')))
p = list(map(int, input().split(' ')))
p = sorted(p)

print(sum(p[0:k]))

Solution (Python):
N, K  = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
sum = 0
count = 1
for i in a:
  sum += i
  count += 1
  if count > K:
    break
print(sum)

Solution (Python):
N,K = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
ans = 0
for i in range(K):
  ans += a[i]
print(ans)

Solution (Python):
import sys
from collections import deque
import copy
def main():
    N, K = map(int, input().split())
    p = [int(i) for i in input().split()]
    p.sort()
    ans = 0
    for i in range(K):
        ans += p[i]
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N,K=map(int,input().split())
p=sorted(list(map(int,input().split())))
print(sum(p[:K]))

Solution (Python):
N, K = map(int, input().split())
p_list = list(map(int, input().split()))

p_list.sort()
p_list = p_list[:K]
print(sum(p_list))

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

Solution (Python):
def readinput():
    n,k=list(map(int,input().split()))
    p=list(map(int,input().split()))
    return n,k,p

def main(n,k,p):
    ps=sorted(p)
    sum=0
    for i in range(k):
        sum+=ps[i]
    
    return sum

if __name__=='__main__':
    n,k,p=readinput()
    ans=main(n,k,p)
    print(ans)

Solution (Python):
N, K = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
c = 0
for i in range(0, K):
    c += h[i]
print(c)

Solution (Python):
n, k = map(int, input().split())
P = list(map(int, input().split()))
P.sort()

s = 0
for i in range(k):
    s += P[i]
print(s)

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[0:K]))

Solution (Python):
N,K=map(int,input().split())
p=list(map(int,input().split()))
p=sorted(p)
print(sum(p[:K]))

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

Solution (Python):
A,B = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort()
print(sum(P[0:B]))

Solution (Python):
n, k = map(int, input().split())

p = list(map(int, input().split()))

p.sort()

ans = 0

for i in range(k):
    ans += p[i]

print(ans)

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

Solution (Python):
n,k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

ans = 0
for i in range(k):
    ans += p[i]

print(ans)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
from decimal import Decimal
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N,K = LI()
P = LI()
P.sort()


print(sum(P[:K]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
total=0
for i in range(k):
    total += p[i]
print(total)

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

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
res = 0
for i in range(k):
    res += p[i]
print(res)

Solution (Python):
line = list(map(int, input().split()))
prices = list(map(int, input().split()))

prices.sort()
x = 0
for i in range(line[1]):
  x += prices[i]
print(x)

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
total=0
for i in range(K):
    total=total+p[i]
print(total)

Solution (Python):
N,K = map(int, input().split())
P = list(map(int, input().split()))

Ps = sorted(P)
print(sum(Ps[:K]))

Solution (Python):


N, K = map(int, input().split())
p = map(int, input().split())

p = sorted(p)

print(sum(p[:K]))

Solution (Python):
import sys

input = sys.stdin.readline


def int_array():
    return list(map(int, input().strip().split()))


def str_array():
    return input().strip().split()



n, k = int_array()
arr = sorted(int_array())
print(sum(arr[:k]))

Solution (Python):
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

p.sort()
ans = sum(p[:K])
print(ans)

Solution (Python):
n,k=map(int,input().split())
p_list=list(map(int,input().split()))
p_list.sort()
print(sum(p_list[0:k]))

Solution (Python):
n, k = map(int, input().split())
p = [int(x) for x in input().split()]
print(sum(sorted(p)[:k]))

Solution (Python):
n, k = map(int, input().split())
p_list = list(map(int, input().split()))

new_list = sorted(p_list)
new_list = new_list[:k]
print(sum(new_list))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Solution (Python):
(N,K)= map(int,input().split())
p = list(map(int,input().split()))
p.sort()
total = 0
for i in range(K):
    total += p[i]
print(total)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))

P.sort()

print(sum(P[:K]))

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

Solution (Python):









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

Solution (Python):

MOD = 10 ** 9 + 7
INFI = 10**10

import math
from collections import deque
import itertools
import heapq

from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint




def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default




def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    p=sorted(p)
    count=0
    for i in range(k):
        count+=p[i]
    print(count)








if __name__ == "__main__":

    main()

Solution (Python):
n, k = map(int, input().split())
p = [int(_) for _ in input().split()]

p.sort()
print(sum(p[:k]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
print(sum(p[:k]))

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 
n,k=map(int,input().split())
p = list(map(int,input().split()))
p.sort()

price = 0
for _ in range(k):
    price+=p[_]
print(price)

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

N,K = LI()
p = LI()

p.sort()
ans = 0
for i in range(K):
    ans += p[i]
print(ans)

Solution (Python):
N, K = map(int,input().split())
P = [int(x) for x in input().split()]
P.sort()
print(sum(P[:K]))

Solution (Python):
N, K = map(int, input().split())
p = sorted(list(map(int, input().split())))
print(sum(p[:K]))

Solution (Python):
def solve() :
    n, k = map(int, input().split())
    p = list(map(int, input().split()))

    p.sort()

    print(sum(p[0:k]))

if __name__ == "__main__":
    solve()

Solution (Python):
n, k = map(int,input().split())

p = list(map(int,input().split()))

ans = 0

p.sort()

for i in range(k):
    ans += p[i]

print(ans)

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

Solution (Python):
[N, K] = list(map(int, input().split()))
P = list(map(int, input().split()))
P.sort()
A = 0
for i in range(K):
    A += P[i]
print(A)

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

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

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
ans = 0
for i in range(k):
    ans += p[i]

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))

    p.sort()
    ans = sum(p[:k])
    print(ans)
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

Solution (Python):
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

N,K = mips()
ans = 0
P = [p for p in mips()]
P.sort()
for i in range(K):
    ans += P[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())

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

Solution (Python):
n,k = map(int,input().split())
p = list(map(int,input().split()))

p.sort()
s = 0
for i in range(k):
  s += p[i]
  
print(s)

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

Solution (Python):
n,k = map(int,input().split())
sum = 0
l = [int(x) for x in input().split()]
l.sort()

for i in range(k):
  sum += l[i]
print(sum)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

kago = sorted(p)[:k]
print(sum(kago))

Solution (Python):

from sys import stdin
input = stdin.readline
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n,k = inm()
p = inl()
p.sort()
print(sum(p[:k]))

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    P = sorted(p)
    ans = sum(P[:K])
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, k = map(int, input().split())
    P = list(map(int, input().split()))

    P.sort()
    sum = 0
    for i in range(k):
        sum += P[i]

    print(sum)


if __name__ == '__main__':
    main()

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
print(sum(p[:K]))

Solution (Python):
def main():
    N, K = map(int, input().split())
    P = sorted(list(map(int, input().split())))

    print(sum(P[:K]))

if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
ans = 0
for i in range(k):
  ans += p[i]
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, k = map(int, input().split())
p = list(map(int, input().split()))

print(sum(sorted(p)[:k]))

Solution (Python):
N,K = map(int,input().split( ))
p = list(map(int,input().split( )))
p.sort()
print(sum(p[:K]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

ans = 0
for i in range(k):
    ans += p[i]

print(ans)

Solution (Python):
N,K = map(int,input().split())
p = list(map(int,input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
N,K=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a)
a=a[:K]
print(sum(a))

Solution (Python):









N,K= map(int,input().split())
P = list(map(int,input().split()))


P.sort()


a=sum(P[0:K])
print(a)

Solution (Python):



import sys


def input():
    return sys.stdin.readline()


def resolve():
    n, k = map(int, input().split())
    p_list = list(map(int, input().split()))

    p_list.sort()

    ans = 0
    for i in range(k):
        ans += p_list[i]

    print(ans)

if __name__ == "__main__":
    resolve()

Solution (Python):
n,k=map(int, input().split())
p=list(map(int, input().split())) 

p.sort()
ans=0

for i in range(k):
    ans += p[i]

print(ans)

Solution (Python):
n,k = map(int,input().split())	
p = list(map(int,input().split()))
p.sort()
print(sum(p[0:k]))

Solution (Python):
N, K = map(int, input().split())
p = sorted(map(int, input().split()))
print(sum(p[:K]))

Solution (Python):
N,  K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

po = sorted(p)

print(sum(po[:k]))

Solution (Python):
N,K=map(int,input().strip().split())
p=list(map(int,input().strip().split()))

p.sort()

ans=sum(p[:K])

print(ans)

Solution (Python):
N,K = map(int,input().split())
P = list(map(int,input().split()))
P.sort()
print(sum(P[:K]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[0:k]))

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

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

Solution (Python):
n,k=list(map(int,input().split()))
P=list(map(int,input().split()))

P.sort()
ans=0
for i in range(k):
  ans += P[i]
print(ans)

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

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))

p.sort()

ans=0
for i in range(k):
    ans+=p[i]

print(ans)

Solution (Python):
import sys
N, K = map(int, input().split())
p = sorted(list(map(int, sys.stdin.readline().split())))
print(sum(p[0:K]))

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = 0
P.sort()

for i in range(K):
    ans += P[i]

print(ans)

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

p = sorted(p)

ans = 0

for i in range(K):
  ans += p[i]
  
print(ans)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
print(sum(p[:k]))

Solution (Python):
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,K,*P = map(int, read().split())

    P.sort()

    print(sum(P[:K]))


if __name__ == "__main__":
    main()

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

Solution (Python):
n, k = map(int,input().split())
plist = list(map(int,input().split()))

plist = sorted(plist)

sum = 0
for i in range(k):
    sum += plist[i]

print(sum)

Solution (Python):
N, K = map(int, input().split())
prices = list(map(int, input().split()))
prices.sort()
print(sum(prices[:K]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())
    p_li = list(map(int, input().split()))

    print(sum(sorted(p_li)[:k]))

if __name__ == '__main__':
    main()

Solution (Python):
n, k = map(int, input().split())
p = sorted(list(map(int, input().split())))

print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
data = input().split()
data = [int(s) for s in data]
sum = 0
data.sort()
for i in range(K):
    sum += data[i]

print(sum)

Solution (Python):
n,k=map(int,input().split())

p=list(map(int,input().split()))

p.sort()

print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
print(sum(p[:K]))

Solution (Python):
N,M=map(int,input().split())
p = list(map(int,input().split()))

p.sort()

k = p[0:M]

print(sum(k))

Solution (Python):
n, k = map(int, input().split())
c = list(map(int, input().split()))
c.sort()
print(sum(c[0:k]))

Solution (Python):
n, k = map(int, input().split())
P = list(map(int, input().split()))
P.sort()

print(sum(P[:k]))

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

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))
p.sort()

ans = sum(p[:K])
print(ans)

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))

P.sort()
print(sum(P[0 : K]))

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
ans=p[0:k]
print(sum(ans))

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
l=sum(p[0:k])
print(l)

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

p = sorted(p)

ans = sum(p[:K])
print(ans)

Solution (Python):
def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    p.sort()
    pl=0
    for i in range(k):
        pl+=p[i]
    print(pl)
if __name__ == "__main__":
    main()

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

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))
P_S = sorted(P)

ans = 0
for k in range(K):
    ans += P_S[k]
print(ans)

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

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

print(sum)

Solution (Python):

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

    
if __name__=="__main__":
    main()

Solution (Python):
N, K = map(int, input().split())
p = list(map(int, input().split()))

p = sorted(p)
ans = 0
for i in range(K):
    ans += p[i]
    
print(ans)

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

Solution (Python):
n, k = map(int, input().split())
P = sorted(map(int, input().split()))

print(sum(P[:k]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

print(sum(p[:k]))

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

Solution (Python):
n, k = map(int, input().split())

ps = list(map(int, input().split()))

st = sorted(ps)

print(sum(st[:k]))

Solution (Python):


N, K = map(int, input().split())
P = sorted(list(map(int, input().split())))

cnt = 0
ret = 0
while cnt < K:
    ret += P[cnt]
    cnt += 1

print(ret)

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

Solution (Python):
N, K = map(int,input().split())

pl = list(map(int,input().split()))
pl.sort()

ans = 0
for i in range(K):
    ans += pl[i]
print(ans)

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

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()

ans = 0

for i in range(K):
  ans += P[i]
  
print(ans)

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

Solution (Python):
n, k = map(int,input().split())
p = list(map(int, input().split()))

p.sort()

count = 0
for i in range(k):
  count = count + p[i]
  
print(count)

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

Solution (Python):
n, k= map(int, input().split())
p = list(map(int, input().split()))
p.sort()
sum_0 = 0
for i in range(k):
    sum_0 += p[i]
print(sum_0)

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

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
ans=0
for i in range(k):
  ans+=p[i]
print(ans)

Solution (Python):
n, k = list(map(int, input().split()))
p_list = list(map(int, input().split()))

sorted_p = sorted(p_list)

print(sum(sorted_p[:k]))

Solution (Python):
N, K = [int(x) for x in input().strip().split(" ")]
P = sorted([int(x) for x in input().strip().split(" ")])
print(sum(P[:K]))

Solution (Python):
n,k = map(int,input().split())
p = [int(x) for x in input().split()]
p.sort()
print(sum(p[:k]))

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()
wa = 0
for i in range(k):
    wa += p[i]
    
print(wa)

Solution (Python):
n, k = map(int,input().split())
a = input().split(" ")
lint_a = [int(n) for n in a]
lista = sorted(lint_a)
kotae=0
for i in range(k):
  kotae+=lista[i]
print(kotae)

Solution (Python):
n,k = map(int,input().split())
p_list = list(map(int,input().split()))
p_list.sort()
result = 0
for i in range(k):
  result += p_list[i]
  
print(result)

Solution (Python):
def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N, K = MI()
P = LI()
P.sort()

print(sum(P[:K]))

Solution (Python):
n,k=map(int,input().split())
li=list(map(int,input().split()))
li.sort()
ans=0
for i in range(k):
    ans+=li[i]
print(ans)

Solution (Python):
def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    p = sorted(p)
    ans = 0
    for i in range(k):
        ans += p[i]
    print(ans)
    
        
if __name__ == '__main__':
    main()

Solution (Python):
n, k = tuple(map(int, input().split()))
p = list(map(int, input().split()))

p.sort()
print(sum(p[:k]))

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))

P.sort()
ans = 0
for i in range(K):
    ans += P[i]
print(ans)

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

Solution (Python):
a,b = map(int, input().split())
al = list(map(int, input().split())) 

als = sorted(al)

print(sum(als[:b]))

Solution (Python):
N,K = map(int,input().split())
Ali = list(map(int,input().split()))

Ali.sort()

print(sum(Ali[0:K]))

Solution (Python):
n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
ans=0
for i in range(k):
  ans+=p[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
p = list(map(int, input().split()))

p.sort()

print(sum(p[:k]))

Solution (Python):
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
print(sum(p[:K]))

Solution (Python):
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
P = list(map(int, input().split()))
P.sort()

ans = 0
for i in range(K):
    ans += P[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
P = list(map(int, input().split()))

print(sum(sorted(P)[:K]))

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

Solution (Python):
import math
import itertools
import collections
import bisect
import heapq

def IN(): return int(input())
def sIN(): return input()
def MAP(): return map(int,input().split())
def LMAP(): return list(map(int,input().split()))
def TATE(n): return [input() for i in range(n)]
MOD = 10**9 + 7

n,k = MAP()
p = LMAP()

p.sort()

print(sum(p[:k]))

Solution (Python):
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))

p.sort()

print(sum(p[:K]))

Solution (Python):
"""
    Satwik_Tiwari ;) .
    20 june , 2020  - Tuesday
"""



from __future__ import division, print_function

from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase


import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter  
from itertools import combinations as comb 
from itertools import permutations as permutate
from bisect import bisect_left as bl


from bisect import bisect_right as br
from bisect import bisect





BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)






mod = 1000000007
def inp(): return sys.stdin.readline().rstrip("\r\n") 
def out(var): sys.stdout.write(str(var))  
def lis(): return list(map(int, inp().split()))
def stringlis(): return list(map(str, inp().split()))
def sep(): return map(int, inp().split())
def strsep(): return map(str, inp().split())
def graph(vertex): return [[] for i in range(0,vertex+1)]
def zerolist(n): return [0]*n
def nextline(): out("\n")  
def testcase(t):
    for p in range(t):
        solve()
def printlist(a) :
    for p in range(0,len(a)):
        out(str(a[p]) + ' ')
def lcm(a,b): return (a*b)//gcd(a,b)
def power(a,b):
    ans = 1
    while(b>0):
        if(b%2==1):
            ans*=a
        a*=a
        b//=2
    return ans
def ncr(n,r): return factorial(n)//(factorial(r)*factorial(max(n-r,1)))
def isPrime(n) : 
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True





def solve():
    n,k = sep()
    a = sorted(lis())
    print(sum(a[:k]))


testcase(1)

Solution (Python):

n,k = map(int,input().split())
p = list(map(int,input().split()))

p.sort()
print(sum(p[:k]))