Roth IRA contribution withdrawl to cancel

During 2020, I contributed to ROTH IRA for 2019 and 2020 then learned that I have excess contribution to IRA thus will have to pay penalties.  I withdrew all the ROTH IRA contributions for 2019 and 2020 to avoid the penalty.  Now I see I owe early withdrawl penalty on it.  Is there any way to file/cancel these properly and avoid penalty?