You could say consciousness is something we all share, and some people are closer consciously than others. That does not mean to say that you could be punished for each others crimes, as when it comes down to the crime there is a choice in doing it, and there's no way of predicting what someone else would choose, no matter how close consciously they are to the person who did the crime.
B is a result of A having gone through prison/punishment. A and B are just different instances of the way someone is, realisticly you're changing with every thought you have. You could say that if the time between A and B was only 1 day, by which point B was really regretful about the crime he did and would never do it again and was really sorry, is it unfair to keep in jail? Which I would say no, jail is actually there to stop people doing crimes in the first place, you don't commit a crime without knowing how long you'll go down for if you get caught.