How to gain 40 pounds in 2 months?

I wouldn't try. I don't know for sure, but i don't think you'd be able to gain that much weight that quickly in a healthy way. It is often not easy for thin people to gain weight, so 40 pounds in such a short time isn't likely feasible unless you pack on unhealthy dense portions of fat and carb calories like fast foods. Better to work on increasing healthy calories at maybe half that pace. Do weight work, too.