Implement a function to detect and remove duplicates from an array while preserving the original order.
Use the function signature def remove_duplicates(nums):. Return a new array containing the first occurrence of each value. The input contains integers, and the original array must not be modified.
def remove_duplicates(nums):