Substantial Presence Test and F-1 with prior visits

If a student with an F-1 visa starting 07-31-2024 but has one prior visit in 2022 for a month on a visiting visa. When does the exempt years start? 2024 or 2022?

I’m new to this skill and I feel like I’m going in circles trying to understand this test.