Get your taxes done using TurboTax

investment interest expense is an itemized deduction, assuming you itemize, that can offset investment income but not long-term capital gains (LTCG) or qualifying dividends (QD) unless an election is made to treat a portion of LTCG and/or QD as not qualifying for their preferential tax treatment. 

first, the $2M flows to form 4797 where it's reduced by any unrecaptured 1231 losses from the prior 5 years and any 1231 losses from the current year. the balance flows to schedule D as LTCG