First things first. Bonus comes out of funds with a owner and nothing with a coach. Both are cap hits I believe whether owner or coach.
A player's salary(cap hit) - Pro-rata bonus for that year and pro-rata salary for that year. Where bonus is spread evenly over the course of a contract, salary (which is not guaranteed) is 'back loaded', so you will pay a lower amount in year 1 and higher amounts every year afterwards.
So with Kiko say 9m a year in salary for 3 years so 27m would be something like below in cap hit if just pure salary.(
Year1 6.76m
Year2 8.79m
Year3 11.5m
Some facts. The hit is really small first year. Takes biggest jump for the final year. 1st to 2nd is a bigger rise than 2nd to 3rd in 4year+ deals
With 7m and a 2m bonus a year it would be like below.
Year1 5.26m + 2m(bonus)
Year2 6.84m + 2m(bonus)
Year3 8.9m + 2m(bonus)
As you see you pay less in later years if with bonus and more in the early years.
With Mario Williams you will pay any money still owed to him from guaranteed money(Bonus). It will be 3mil in his last year as I guess he has 21m bonus spread over the 7 years. If you cut with more than 1 year left the cap penalty is spread over 2 years so in your case the 6m would be 3m this season and 3m penalty the next as well.
So to be precise to Mario you would get 8mil if you cut/trade now(His cap hit(11m) minus the pen hit for that season(3m)
If you wait a season his hit will go to 24m
so a extra 13m will come out of your cap first before you get 24m back from cutting him or trade which would get the 3m pen taken away for that season only. So 21mil back but you added a extra 13m so you really only gain the 8mil you could get the season before as well.
Added some detail and not straight answers but hope that makes sense and helps you