class Solution:
    def search(self , nums: List[int], target: int) -> int:
        # write code here
        left = 0
        right = len(nums)
        if right == 0:
            return -1
        while left < right:
            mid = (left + right) // 2
            if nums[mid] >= target:
                right = mid
            else:
                left = mid + 1
        return right if nums[right] == target else -1