A CGI Nederland service workflow receives an unsorted list of integer identifiers and a target value. Implement a function that returns the indices of two distinct elements whose values add up to the target.
Given an integer array nums and an integer target, return a list containing the two indices i and j such that nums[i] + nums[j] == target. Return the indices in ascending order of discovery. Each array element may be used at most once. Every valid input contains exactly one solution.
The function must return a Python list of two integers. Design an efficient solution suitable for large arrays.
def two_sum(nums, target):