The "Initialize Variable" of the variable belongs right at the beginning, near the trigger. Just let the Value field be empty. After that, you can set your array as described using "Set Variable" in your Y/N Condition. I didn't realize that wasn't clear
sort(variables('YourArray'))
sort(variables('YourArray'), item()?['Delay'])