Created
September 21, 2017 12:54
-
-
Save asuka-mirai/dd3900750338238b0b3b845134135705 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
N, K = map(int, input().split()) | |
a = list(map(int, input().split())) | |
a = sorted(a) | |
ans = N | |
t = 0 | |
for i in range(N-1, -1, -1) : | |
if t+a[i] < K : | |
t += a[i] | |
else : | |
ans = min(ans, i) | |
print(ans) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment