Gaining

Is it more unhealthy to be slightly overweight for a long time or to gain weight rapidly?

Imagine person A who has been overweight for all their life.

Person B has been healthy all their life, but gains 30 lbs and becomes overweight within a span of a few months, but then stays at that weight.

Is there any difference in short-term and/or long-term health between A and B?
4 years