N,K = map(int, input().split()) F = list(map(int, input().split())) F = F.sort(reverse=True) A = 0 for i in N: if i < K: A += F[i] else: break print(A)