What Contributed Most to Your Weight Gain?

Since I'm trying to gain weight, I'm curious to know what contributed the most to your weight gain—was it calories, fats, proteins, carbs, or something else? I'd love to hear your suggestions and experiences.