The M+2 peak in mass spectrum is found if the chlorine or bromine is present. The two molecular ion peaks (M+ and M+2) each contain one chlorine atom. The chlorine can either be 35Cl and 37Cl. 35Cl isotope has a formula mass of 78 and 37Cl has a formula mass of 80. A ratio of 3:1 describes the peak heights. This tells us that chlorine contains 3 times as much of the 35Cl isotope as the 37Cl one. Therefore, there will be 3 times more molecules that contain the lighter isotope than the heavier one.
Compounds that contain bromine have a different ratio. They have a 1:1 ratio. Bromine has two different isotopes as well, 79Br and 81Br. If there are two lines in a molecular region with a gap of 2 m/z units and are of almost equal heights, a bromine atom is present in the molecule.
After reading the information on this website I feel that I better understand the M+2 peak. I have put the link at the bottom of the blog if you would like to go check the website out for yourself!
http://www.chemguide.co.uk/analysis/masspec/mplus2.html