N, K = map(int, input().split()) A = list(map(int, input().split())) A.sort(reverse = True) T = 0 for i in range(K): if A[i] > 0: T += A[i] else: pass print(N, K ,A, T)