def sgets = gets.strip def get_int = Integer(sgets) def get_list = sgets.split def get_int_list = get_list.map { Integer(_1) } def puts_yn(b) = puts(b ? 'Yes' : 'No') n, x = get_int_list a = get_int_list d = a.sum - x puts [d, 0].min