Some general info
- Each host needs to be licensed.
- A minimum of 8 core licenses is required for each physical processor and a minimum of 16 core licenses is required for each server.
- Core licenses are sold in packs of two.
- Standard Edition provides rights for up to 2 Operating System Environments or Windows Servers containers with Hyper-V isolation when all physical cores in the server are licensed. For each additional 1 or 2 VMs, all the physical cores in the server must be licensed again.
- DataCenter Edition provides rights for unlimited Operating System Environments or Windows Servers containers with Hyper-V isolation when all physical cores in the server are licensed.
So if you could have all 40 on one host or the other even for one minute then each host will need to be licensed to cover 40 VMs. Seems you'll probably want DataCenter licenses. As far as I know they haven't released a Server 2022 licensing datasheet but the general licensing hasn't changed.
https://download.microsoft.com/download/7/C/E/7CED6910-C7B2-4196-8C55-208EE0B427E2/Windows_Server_2019_licensing_datasheet_EN_US.pdf
http://download.microsoft.com/download/3/D/4/3D42BDC2-6725-4B29-B75A-A5B04179958B/WindowsServer2016VirtualTech_VLBrief.pdf
--please don't forget to upvote
and Accept as answer
if the reply is helpful--