Cap the highest values in a list so that the sum equals a given number
Python 3, 70 77 56 bytes

-21 bytes thanks to Jonathan Allan!



def f(l,n):
 while n/all(l)&lt;sum(l):l[l.index(max(l))]-=1


Try it online!