This is my stance.
I can't condone the searching of the phone, but the boyfriend can't take the moral highground along the lines of "I can't believe you searched my phone, you have trust issues that need to be resolved before we can continue the relationship" because OP was right, he had been unfaithful and she unfortunately found out the fact that he had been deceiving the OP for two years by not telling her that she was in a relationship with someone who had not been entirely faithful to her. Whether it was 2 weeks, 2 months or 2 years into the relationship, once the exclusivity had been established, breaking that by kissing someone else is cheating. By keeping this secret from OP for two years, the OP has been in a relationship that was not as secure as she thought it was and one which she may not have remained in for two whole years had she known that at just 2 weeks in, her boyfriend was kissing another girl.
While I wouldn't check my partner's phone, if I did somehow find out he had been unfaithful at the beginning of our relationship, I'd leave. I genuinely don't want to be with someone who cannot be faithful to me, as I am to him. I only expect from my partner the behaviour which he expects from me and as I have been entirely faithful, if I found he hadn't been then it would be his mistake that ended the relationship even if it was years later.
This is because, if my partner had told me at 2 weeks into our relationship that he'd kissed another girl, I'd have left him there and then. I do not find men attractive when they cheat, it is a very unattractive trait and if a man cheats on me, I no longer want to be with him no matter how much I love him.
If he denies me the knowledge of his cheating for years as he doesn't want the relationship to end and I then find out, I'll still make the same decision I would have if he'd told me at the time. I'd leave him. I would not be able to trust him not to do it again.
OP, while looking through his phone can't be condoned as everyone should have the right to privacy, I'm sorry that you came across the fact he'd cheated on you so early into your relationship. I hope you have the strength to make whichever decision you feel is genuinely best for you moving forwards.