The M40 was a diesel locomotive designed in the early sixties to replace steam locomotives in passenger service. It had a 1,000-hp Ganz-Jendrassik diesel engine that was housed under a long hood, together with the traction generator and other equipment. The cab was located above the other bogie and behind it was a steam generator. Its general appearance led to the nickname “Púpos”, what means “humpback”. A total of 74 were built by Ganz-MÁVAG in three batches between 1963 and 1970. Some of these were built in Russian broad gauge for service near the border, but these were later rebuilt to standard gauge. Some had been built without boilers and others later lost their boiler in exchange for some ballast. Many were withdrawn in the eighties and nineties and around 20 are still in service today. After a single one was rebuilt with a Jenbacher engine in 1994, only three received a Caterpillar engine in 2002, what did not become a success due to high costs.