Have you tried out the Insert node for arrays?
You can use it to add a new element at the specified index and then remove the final index if the array length becomes greater than 5.