Ho hum, if you don't add enough values in to the List (you're not actually sorting an array, you realise?) you'll get that error. If you add too many values to the List, the end of it won't be sorted.

You've got a hard-coded number of elements that you're trying to sort. But you have a variable length data set that you're sorting. Not happy bed-fellows.