You need to find two elements in the nums array such that their sum equals target and return their indices as an array.