https://www.acmicpc.net/problem/11047
import sys
input = sys.stdin.readline
N, amount = map(int, input().split())
coins = [int(input()) for _ in range(N)]
coins = coins[::-1]
total_cnt = 0
for coin in coins:
if amount > 0 and amount >= coin:
cnt = amount // coin
amount -= coin * cnt
total_cnt += cnt
print(total_cnt)
import sys
input = sys.stdin.readline
N, amount = map(int, input().split())
coins = [int(input()) for _ in range(N)]
cnt = 0
for coin in coins[::-1]:
cnt += amount // coin
amount %= coin
print(cnt)
amount = 2000
cnt = 0
coins = [500, 100, 50, 10] # 내림차순 정렬돼있어야 함.
for coin in coins:
cnt += amount // coin
amount %= coin
print(cnt)