Given a sorted array and a target, find the first index of the target. Return -1 if the target is not in the array.
Implement first_index(nums, target). The array is sorted in nondecreasing order and may contain duplicates. Return an integer index using zero-based indexing.
def first_index(nums, target):