#!/usr/bin/python3 # 32-Z1-1 # Načtení parametrů (první řádek) parameters = input().split() # Převedení parametrů na čísla price_count, available_money = map(int, parameters) # Načtení cen (druhý řádek) a jejich převedení na čísla prices = input().split() prices = [int(price) for price in prices] price_sum = sum(prices) thrown_away = 0 # Pomocí sorted() si seřadíem ceny od největší a procházíme je for price in sorted(prices, reverse=True): if price_sum > available_money: thrown_away += 1 price_sum -= price else: break print(thrown_away)