Wiring for new 40 amp wall oven and cooktop
My first concern looking at the subpanel is if that bare #6AL is in fact a ground and the two appliances are straight 240V then the two white wires connect to the buss should have some green tape on them. If it's not a ground but actually a neutral, where are the grounds?  You will need to ground everything.

I would try utilizing the #6AL XHHW since changing it out would be difficult. It is rated for 50amps according to my chart so the breaker in the main panel should be changed to a 50AMP. Since the two NM-B cables can easily replaced, change them to NM-B 3#8 and replace both breakers in the subpanel to 40 AMP. 

Where actually is the subpanel?

News flash: The name plate on the oven states "four wire".  Major game changer. The new wire you run will have to have a ground. This will probably require you to change the #6AL run to 3#6cu plus ground or just run two 3#8 with gnd, one for each appliance, add additional breaker in main panel. Both breakers would be 40AMP and eliminate the subpanel.

If your owner's manual states that you can hook up the four wire appliance to a three wire source, then it is ok to do it.