import bisect def find_le(a:list[int], x:int): # 探索したい数値以下のうち最大の数値を探索 i = bisect.bisect_right(a, x) if i: return a[i-1] else:return -1 N,M,K = map(int, input().split()) A = list(map(int, input().split())) A = sorted(A) cards = 0 points = 0 while cards < K: c = find_le(A, M - points) if c == -1: break else: points += c cards += 1 print(points)