Ineligible for HSA in 2023. Most contributions already spent on medical expenses. How much should be withdrawn and reported on Amended return.

One more question related to my previous post:
https://ttlc.intuit.com/community/taxes/discussion/how-to-amend-2023-tax-return-after-withdrawal-of-...

We established that I was not eligible to contribute to the HSA in year 2023 and need remove the entire yearly contribution or s $8750 from the HSA.
I understand that $8750 + earning needs to be reported on the Amended Tax return as taxable income.
Question is: 
we had about $8100 worth of medical expenses in 2023 paid from that HSA and reported on Form 1099-SA as "qualified distributions". 
Would that be correct to say that to complete the removal of wrongly contributed funds I need to withdraw the difference 
($8750 + earnings) - $8100 
and enter that difference in TurboTax as non-qualified distribution?