Air strikes kill 40 militants in NW Pakistan: military