K-1 and Form 4797

Last year we sold a farm that had been owned by an S-Corp. I have all the stock blocks needed to establish the stock basis when the books were closed on 12/31/2021.

 

I understand that Form 4797 will be used to report this transaction. Do I use the amount shown on Line 16 (code D) items affecting shareholder’s basis on the K-1 from the corporation as the sales price or some other amount (such as my share of the actual sale price of the farm)?

 

As always, thanks for any and all help.