Make sure you get plenty of protein (and not just vegan stuff, eat real animal flesh, eggs, drink milk, etc) and do strength training exercises. You can do some cardio stuff, but you will want to get some advice on how to build major muscle groups without injuring yourself. If you have 14 months you should make it as long as you don't have any lifestyle issues that work against your effort. Without sounding snippy, being a vegetarian can sometimes be a huge barrier against healthy weight management, and doing too much cardio exercise like running can also work against you. Swimming can build muscle but it often leads to very low body fat percentage.
Whatever you do, don't try to gain weight by sitting around playing video games and eating fatty snacks. Any excess fat you gain before basic will end up burned right off. You're better off building muscle if you can, and figuring out what sorts of foods you have to eat so you can focus on those during your *short* mealtimes during basic training.