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 = sorted(p)
ans = sum(p[0:K])
print(ans)

Solution (Python):

import math



from collections import deque
from collections import Counter




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 = sorted(map(int,input().split()))
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Solution (Python):
n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr.sort()
print(sum(arr[:min(n,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=ans+P[i]
    
print(ans)

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()
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Solution (Python):
import sys

input = sys.stdin.readline

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()))
p2=sorted(p)
ans=sum(p2[0:k])
print(ans)

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

Solution (Python):
s,t=map(int,input().split())
lst=list(map(int,input().split()))

lis=sorted(lst)



count=0
for j in range(t):
  count+=lis[j]
  
print(count)

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

p.sort()

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

print(ans)

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

p.sort()
ans = 0

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

print(ans)

Solution (Python):

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

    p_list.sort()

    print(sum(p_list[:k]))


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    N, K = [int(i) for i in input().split(" ")]
    p = [int(i) for i in input().split(" ")]
    p = sorted(p)
    print(f"{sum(p[:K])}")


if __name__=="__main__":
    main()

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

print(sum(p_list[:k]))

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

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

print(sum(target))

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):


import sys































def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, k = mi()
    L = sorted(lmi())
    print(sum(L[:k]))


if __name__ == "__main__":
    main()

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

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

plist = list(map(int,input().split()))
plist.sort()
lists = plist[:int(k)]

print(sum(lists))

Solution (Python):
import sys


def main():
    input = sys.stdin.buffer.readline
    n, k = map(int, input().split())
    ps = sorted(map(int, input().split()))
    print(sum(ps[0: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())
ps=list(map(int,input().split()))

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

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

p.sort()

print(sum(p[:k]))

Solution (Python):
from sys import stdin

def main():
    n, k = [int(x) for x in stdin.readline().rstrip().split()]
    p = [int(x) for x in stdin.readline().rstrip().split()]
    p.sort()
    fee = 0
    for i in range(k):
        fee += p[i]

    print(fee)

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):
import numpy as np
import sys
import math
import itertools
import collections

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

P.sort()

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

print(tot)

Solution (Python):
m = list(map(int, input().strip().split(' ')))
n = list(map(int, input().strip().split(' ')))
n.sort()

res = 0
for i in range(m[1]):
	res+=n[i]
print(res)

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

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

Solution (Python):
[n,k] = list(map(int, input().split()))
pList = list(map(int, input().split()))
price = 0
for i in range(k):
    price += pList.pop(pList.index(min(pList)))
print(price)

Solution (Python):


def resolve():
    import sys
    input = sys.stdin.readline
    nk = input().rstrip().split(" ")
    pn = [int(p) for p in input().rstrip().split(" ")]
    pn.sort()
    print(sum(pn[:int(nk[1])]))




if __name__ == "__main__":
    resolve()

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.sort()

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=sorted(map(int,input().split()))
ans=0
for i in range(K):ans+=p[i]
print(ans)

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

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=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()))
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())
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(map(int,input().split()))

p_new = sorted(p)

ans = sum(p_new[0:k])
print(ans)

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

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 = 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())
Mylist = input().split()
Mylist = [int(s) for s in Mylist]

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

Solution (Python):
import sys
n,k = map(int, sys.stdin.readline().rstrip("\n").split())
p = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
p.sort()
print(sum(p[:k]))

Solution (Python):
import sys

Line = [int(s) for s in input().split()]

N,K = Line[0],Line[1]

Line = [int(s) for s in input().split()]

Line.sort()



ans = 0
count = 0

for i in Line:
    ans += i
    count +=1
    if count == K:
        print(ans)
        sys.exit()

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())
A = [int(x) for x in 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):


def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))

    p.sort()
    ans = 0
    for k in range(K):
        ans += p[k]
    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):

def fruits(arr, k):
    arr.sort()
    ans = 0
    while k:
        ans += arr.pop(0)
        k -= 1
    return ans



n, k = list(map(int, input().rstrip().split()))
ar = list(map(int, input().rstrip().split()))
print(fruits(ar, 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 = ans + p[i]


print(ans)

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

y= [int(i) for i in input().split()]

y.sort()

sum1 = 0
for i in range(b):
    sum1 += y[i]
print(sum1)

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

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()

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

print(sum)

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()
sum = 0

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

print(sum)

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

Solution (Python):
n,k,*l = map(int,open(0).read().split())
l1 = sorted(l)
print(sum(l1[:k]))

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

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(map(int, input().split(' ')))
p.sort()
print(sum(p[:k]))

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

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

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

print(ans)

Solution (Python):
N,K = map(int,input().split())
p = [int(i) for i in input().split()]
p = sorted(p)
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())
q=list(map(int,input().split()))
q.sort()
ans=0
for i in range(k):
    ans+=q[i]
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):
from typing import List


def count_sort(array: List[int]) -> List[int]:
    max_num = max(array)
    min_num = min(array)

    count_element = [0] * (max_num - min_num + 1)
    for element in array:
        count_element[element - min_num] += 1

    result = []
    for index, cnt in enumerate(count_element, start=min_num):
        result.extend([index] * cnt)

    return result


def main() -> None:
    N, K = map(int, input().split(' '))
    array = [int(_) for _ in input().split(' ')]

    print(sum(count_sort(array)[:K]))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from functools import reduce


def input():
    return sys.stdin.readline()[:-1]


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

print(sum(P[:K]))

Solution (Python):
(n, k) = [int(s) for s in input().split()]
p_list = [int(s) for s in input().split()]

p_list = sorted(p_list)

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

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())
print(sum(sorted(list(map(int, input().split())))[: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())
p = list(map(int, input().split()))
ans = 0
for i in range(k):
    ans += min(p)
    p.remove(min(p))
print(ans)

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


def S():
    return input().rstrip()


def I():
    return int(input())


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


n, k = MI()
pl = list(MI())

pl.sort()
print(sum(pl[: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())
num_list = list(map(int,input().split()))

num_list.sort()
ans = 0

for i in range(k):
  ans += num_list[i]
else:
  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 = list(map(int, input().split()))
p = list(map(int, input().split()))
arr = []
ans = 0

for i in range(N):
  arr.append(p[i])
arr= sorted(arr)

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

print(ans)

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, K = MAP()
    P = LIST()

    P.sort()

    print(sum(P[:K]))


if __name__ == '__main__':
    main()

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



if __name__ == '__main__':
    solve()

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

Solution (Python):
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)

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

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

arr.sort()
ans = 0
while k > 0:
    ans += arr[0]
    arr.pop(0)
    k -= 1

print(ans)

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[0:k]))

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

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

print(c)

Solution (Python):
n, k = map(int, input().split())
value = list(map(int, input().split()))
value.sort()
print(sum(value[: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()))
ans = 0

p.sort()

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[0:K]))

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

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

L = sorted(L)
A = 0

for i in range(k):
    A += L[i]

print(A)

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

P.sort()

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

print(answer)

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.sort()
print(sum(p[:k]))

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

q = sorted(p)

print(sum(q[:k]))

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

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy

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

if __name__ == "__main__":
    main()

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):
import sys
N,K=map(int, sys.stdin.readline().split())
P=map(int, sys.stdin.readline().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())
a=list(map(int,input().split()))

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

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 = sorted(P)
ANS = 0

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

print(ANS)

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

Solution (Python):


import sys

def main():
    fruit_list=[]
    n,m = map(int,input().split())
    fruit_list= [int(i) for i in input().split()]
    fruit_list=sorted(fruit_list)
    print(sum(fruit_list[:m]))

if __name__ == "__main__":
    main()

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

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())
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_sort = sorted(p)

num = 0

for i in range(k):
    num += p_sort[i]
    
print(num)

Solution (Python):
from functools import reduce

N, K = [int(x) for x in input().split()]
P = sorted([int(x) for x in input().split()])
print(reduce(lambda x, y: x + y, P[0:K]))

Solution (Python):
def main():
    N,K = [int(x) for x in input().split()]
    P = [int(x) for x in input().split()]
    ans = 0
    for i,p in enumerate(sorted(P)):
        if i == K:
            break
        ans += p
    print(ans)

if __name__ == '__main__':
    main()

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

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

Ps.sort()


ans = 0
for P in Ps[:K]:
    ans += P

print(ans)

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

p.sort()

print(sum(p[:k]))

Solution (Python):


from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')


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

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

Solution (Python):







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


result = 0
for i in range(K):
    result += arr[i]

print(result)

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()))

ans = []
for k in range(K):
    ans.append(min(P))
    P.remove(min(P))

print(sum(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 = (int(i) for i in input().split())
P = [int(i) for i in input().split()]

P.sort()
if k <= n:
    print(sum(P[:k]))
else:
    print(sum(P) + P[0]*(k-n))

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()
c=0
for i in range(k):
    c+=p[i]
print(c)

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

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):
n,k = map(int ,raw_input().split(' '))
prices = map(int, raw_input().split(' '))
prices.sort()
print sum(prices[:k])

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):
def solve():
    n, k=map(int, input().split())
    p=list(map(int, input().split()))
    p.sort()

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

    print(t)


if __name__ == '__main__':
    t=1
    for _ in range(t):
        solve()

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()
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Solution (Python):

import math

n,k=map(int,input().split())
seq=list(map(int,input().split()))
seq.sort()
print(sum(seq[: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 = sorted(p)
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[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=list(map(int,input().split()))
p=list(map(int,input().split()))
p.sort()
x=0
for i in range(K):
    x+=p[i]
print(x)

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

print(sum(p[:k]))

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


if __name__ == '__main__':
    main()

Solution (Python):
N, K = list(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 = 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):
n,k = [int(i) for i in input().split()]
num = [int(i) for i in input().split()]
num.sort()
cont=0
i=0
for i in num:
    if k<=0: break
    cont+=i
    k-=1
print(cont)

Solution (Python):
N,K=map(int,input().split())
p=[]
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())
p = list(map(int, input().split()))
ans = 0
p.sort()
for _ in range(K):
    ans+=p[_]
print(ans)

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

res = 0

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

print(res)

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()))
sum = 0

p.sort()

for i in range(0, K):
    sum += p[i]

print(str(sum))

Solution (Python):
import sys
import numpy as np


MODE = 1


DIMENSION = 2


INT_TYPE = 1

if not (MODE):
    with open("input.txt", "r") as f:
        s = f.read()
else:
    s = sys.stdin.read()

if DIMENSION == 0:
    if INT_TYPE == 1:
        s = int(s)
elif DIMENSION == 1:
    if INT_TYPE == 0:
        s = s.split()
    elif INT_TYPE == 1:
        s = [int(x) for x in s.split()]
elif DIMENSION == 2:
    if INT_TYPE == 0:
        s = [x.split() for x in s.splitlines()]
    elif INT_TYPE == 1:
        s = [[int(y) for y in x.split()] for x in s.splitlines()]

N, K = s[0]
p = s[1]
p.sort()
print(sum(p[:K]))

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

PS = sorted(PS, reverse=False)



print(sum(PS[:K]))

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

Solution (Python):




def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



def input_to_int_map():
    return map(int, input().split())



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()
    p = input_to_int_tuple()

    p_sorted = sorted(p)

    return sum(p_sorted[:k])

if __name__ == "__main__":
    print(main())

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

    return

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[:k]))

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

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());
a = list(map(int,input().split()));

a.sort()

v = 0;
for i in range(k):
    v = v + a[i];
    
print(v)

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

p.sort()
c = 0

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

print(c)

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

p.sort()

r = 0
for i in range(K):
    r += p[i]

print(r)

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

n, k = map(int, input().split())
p = list(map(int, input().split()))
enum = list(enumerate(p))
enum.sort(key=lambda x: x[1])
res = 0

for i in range(k):
    res += enum[i][1]

print(res)

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

sum = 0

a_sorted = sorted(a)

for cnt in range(k):
    sum += a_sorted[cnt]

print(sum)

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

sum_ = 0
for i in range(K):
  min_ = min(p)
  argmin = p.index(min_)
  del p[argmin]
  sum_ += min_

print(sum_)

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

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

Solution (Python):
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    n,k = IL()
    p = list(IL())
    p.sort()
    ans = 0
    ans = sum(p[:k])
    print(ans)
    return

if __name__=='__main__':
    Main()

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

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

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

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()
result=0
for i in range(k):
    result+=p[i]
print(result)

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

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


print(sum(p_list[:k]))