Two defense contractors will benefit the most if President Donald Trump's budget plan is implemented, according to one top Wall Street firm.

J.P. Morgan said Boeing and Lockheed Martin both received higher spending budgets for their key programs under the proposal.

"From a high level, the FY19 budget largely conforms to press reports of the past few weeks and the bipartisan deal enacted last Friday. Digging into the available details, we think that plus-ups for key missile defense and legacy aircraft platforms make Lockheed Martin and Boeing early winners," analyst Seth Seifman wrote in a note to clients Tuesday.

Seifman said the new fiscal 2019 budget if enacted would be a spending increase of 5 percent year over year for the Department of Defense. He noted the proposal raises the orders for multiple military hardware programs.

For Lockheed Martin "DoD is requesting funding for additional Black Hawks, C-130s, and now plans to spend more on key missile defense programs including THAAD, Aegis and PAC-3 MSE," the analyst wrote. "Boeing may see incremental orders for helicopter programs (+3 Apaches, +1 Chinook) along with three more P-8s and higher funding for the Ground-based Midcourse Defense program."

J.P. Morgan has an overweight rating on Boeing shares with a $400 price target, representing 16 percent upside to Monday's close.

The firm also has a neutral rating on Lockheed Martin shares with a $385 price target, representing 11 percent upside to Monday's close.

Boeing shares fell 0.2 percent Tuesday, while Lockheed Martin stock rose 1.3 percent.