# No.5 数字のブロック math_list = input('Block size') math_list = math_list.split() math_range = math_list.pop(0) math_range = int(math_range) length = math_list.pop(0) total = 0 box = 0 while math_range > total: min_math = min(math_list) total = total + int(min_math) math_list.remove(min_math) if math_range < total: continue box = box + 1 print(total) print(box)