Explain the time complexity of your solution.
Implement sum_array(nums), which returns the sum of all integers in nums. The function accepts a list of integers and returns one integer. State the time and auxiliary space complexity of your implementation, including why each loop or data structure contributes to that complexity.
def sum_array(nums):