40 minutes is the exact minimum connecting time at AMS. It's been the minimum connecting time since time immemorial, and although I've done 40 minute connections in recent years my personal opinion is that it's no longer appropriate except for Schengen-to-Schengen connections where you just walk from one gate to the next.
HAM flights are normally E190s and you normally disembark at a gate (I travel AMS-HAM a lot so this is from personal experience). I don't know, without looking it up, if BHX flights go from D6 (the bus gate) or one of the other D gates. D6 has the advantage that it's not far to go, but it's got the disadvantage that it's ten gates rolled into one with only one security checkpoint so you often have long queues.