find the next available number in a selected range of an array

hi

i have an array that may have a lot of random numbers. i am interested in finding the next available "missing" number in a certain range of these random numbers

for example:

$myArray = 1,2,10,6,11,12,18,9,4,20,21,40

the range i am considering is 10 to 20 . so i need to get the next available number in this range that is not in the array = 13

how can i do this in powershell