They should split the profits based on whatever they agreed to beforehand. And yes, they should absolutely have agreed on something beforehand. No matter how vague things are, there should be an agreement defining what B is expected to put in and what B is expected to get out of it. That agreement could be a percentage, it could be "you can get your investment back plus the first X% of value increase", whatever; or it could be that B gets nothing back. It all depends on why A and B are making the agreement and what the incentives are on both sides.
If they for some reason didn't, then I imagine a judge if asked in a court of equity would probably give 16% (or specifically, 1/6th) of the profit to person B based on the proportion of initial value contributed. But it's entirely possible that if there are no documents whatsoever, a judge in a court of law would give 0 to person B. You ask for "fair", so I suppose 16% seems correct.
But really any time entering into an arrangement like this, you should always agree ahead of time. Person B might be critical to the investment, so critical that person A might be willing to split 50% of the profit. Especially if person A was living in the property, and so had more benefit from it than the investor did. Who knows; that's why you agree ahead of time, so it's clear.
On the other hand if both Person A and Person B live in the property, then perhaps Person B is entitled to less than 16%, because they got equal benefit from living there (50%). If it was a decade or something, that could be a huge benefit - perhaps more valuable than their 16%. 20k a year in rent for half of a $1.2M property sounds eminently reasonable, after all. And if the improvements specifically benefited Person B - say they were to add a second bathroom and a second patio deck on Person B's side of the house - then again Person B is gaining benefit above and beyond the increase-in-value.