First of all, good question. I think many of us have pondered about this at some point in his or her life, myself included.
We may see as though people 'enjoy committing the haram', but in reality anything haram is a poison for the soul. There is a hadith that says every time we commit sin, a black spot appears on our heart.
Abu Hurairah (raa) narrated: Allah’s Messenger May peace be upon Him
said :
“When a slave (a person) commits a sin (an evil deed) a black dot is
dotted on his heart. Then if that person gives up that evil deed
(sin), begs Allah to forgive him, and repents, then his heart is
cleared (from that heart covering dot); but if he repeats the evil
deed (sin), then that covering is increased till his heart is
completely covered with it. And this is Ar-Ran that Allah mentioned
(in the Quran),
“Nay! but on their hearts is the Ar-Ran (covering of evil deeds and
sins) which they used to earn” (83:14)”
Source: At-Tirmidhi, Vol 5 , Hadith No: 3334
I don't know about you, but honestly whenever I commit something haram, I would feel like s**t on the inside. I may 'enjoy' doing it at the time, but that feeling of s*** will haunt me for days on end. I am convinced that one can never 'enjoy committing the haram.' It is nothing more than a constant lie that we tell to ourself.
To answer your question, let us use being healthy as an analogy for being a good Muslim. B has been taking care of health all his life while A has wasted years binging, smoking, etc. before finally quitting. Now both of them are trying to lead healthy lifestyle. But is A's level of health nowhere close to B's. No way. A has to first undo years of damage done to his body. B, on the other hand, may look forward to active life even in the golden years.
Similarly, someone who has spend years obeying Allah will accumulate far more rewards than someone who has just repented. A, the guy who just repented may have 'enjoyed' the haram, but he will suffer in at least two ways. One, his sins may not be totally forgiven and therefore he still has to be punished. Two, he will experience a world of regret when he sees all the wonderful rewards that B has accumulated all the while he spent in obedience.
Allah is fair and He knows best.