Truncate an array using length