class Solution:
def __init__(self, nums: List[int]):
self.nums = nums
def pick(self, target: int) -> int:
count = 0
res = -1
for idx, ele in enumerate(self.nums):
if ele == target:
count += 1
if count == 1:
res = idx
else:
rand = randint(1, count)
if rand == 1:
res = idx
return res