The 59M and 5AM maps are not compatible. The former is 256kb and the latter 320kb. You could create a custom map for the 5AM by using TunerPro to change the fuelling/timing where required. I believe some have had success by using the later 5AM ST4S CanBus mapping on the earlier bikes. https://www.ducatiforum.co.uk/threads/another-st4s-immoblizer-issue.74774/page-15
As @chrisw said the BIN files are not interchageable but I had a quick look on the usual ECU repo site and there are both 59M and 5AM BIN files for the ST4s.