A HiFi harness and a XD600/6 will solve that for you, PnP and better sound than OEM. That would be about $450 shipped.
There are 2 late OEM HiFi amps (small silver box) on eBay, one at $300 and the other at $400.
No matter what you do, you must fix that water leak before replacing the OEM amp.
-2012 E92 M3 Jerez Black/Rust Brown, M-DCT: September ED
-2008 E90 M3 Melbourne Red/Bamboo, 6MT: Gone
-2007 MK5 GTI United Grey/Grey, DSG: Gone
-2004 E46 M3 Carbon Black/Cinnamon, 6MT: Gone
-2002 E46 330i Orient Blue/Natural Brown, 5MT: Gone