Daf 57a
On Daf 57a it says that if one dreams that he is undergoing a blood-letting, it means that his sins are forgiven. But the gemara asks that another teaching says that the dream means that his sins are put in order? It answers that the meaning is that his sins are put in order so as to be forgiven.
We can explain that the gemara means that when his sins are in order they are certainly going to be forgiven. Because, as it says many times in the Selichos prayers, Hashem "removes the first". That is, the first sin which is to be placed in the scales of justice Hashem removes to the side and does not place in the scales. Therefore, if his sins are equal to his good deeds the scales will tilt in his favour since the first sin was not added to the scales. But Rava teaches in the gemara Rosh Hashanah 17a that this first sin is not erased, but rather if his sins are more than his good deeds then this sin is reckoned together with the others.
From this it emerges that if a person is a Tzaddik whose good deeds exceed his sins, or even if he is an average person whose sins equal his good deeds, his sins are placed in the scales in order, but the placing starts from the second sin since the first sin has been removed. And if they remain in order then he is certainly not among those whose sins exceed their good deeds. Because if he was, then the first sin which had initially been removed would have been added to the scales at the end, as Rava taught, and consequently the sins would no longer be in order since the first sin would be placed after the last.
This then is the meaning of the gemara, that when the sins are in order, which shows that the first sin was not added to the scales at the end, his sins are certainly to be forgiven.