Write a simple function to find duplicates in an array.
Use the signature def find_duplicates(nums):. The input is a list of integers, and the function should return a list containing each value that appears more than once, included only once and ordered by the first time its repetition is encountered. Return an empty list when no value is duplicated.
def find_duplicates(nums):