Yes, you should have been keeping track of your losses on Form 8582. If you didn't have a tenant in 2021, you will enter your sale in Sale of Business Propery. Go back to your last return that had Schedule E and find your loss amount and depreciation. You will have to manually adjust your basis.
If this was your primary home for those two years, enter this in Sale of Your Home. You will still need to manually add the losses, but the program will ask for your depreciation.
Add the losses and subtract the depreciation from your basis.