Python 3   ||   13 lines,  bisect_left   ||   T/S: 92% / 64%
Here\'s the plan:\n\n1. We use ch to 0-index changeIndices (... annoying...).\n\n1. We use the boolean functionallMarked whether a particular number of seconds 
Here\'s the plan:\n\n1. We use `ch` to 0-index `changeIndices` (... annoying...).\n\n1. We use the boolean function`allMarked` whether a particular number of `seconds` is sufficient to mark all indices of `nums`.\n\n1. We use `bisect_left` to determine the minimum number of such `seconds`; if not, we return -1.\n\n\n\n```\nclass Solution:\n    def earliestSecondToMarkIndices(self, nums: List[int], changeIndices: List[int]) -> int:\n\n        def allMarked(seconds: int)-> bool:\n            marked = set()\n            \n            for i in range(seconds-1, -1, -1):\n                seconds = min(seconds, i+1)\n\n                if ch[i] not in marked:\n                    seconds-= nums[ch[i]] + 1\n                    if seconds < 0: return False\n                    marked.add(ch[i])\n                \n            return len(marked) == n\n\n\n        n = len(nums)\n        ch = list(map(lambda x: x-1, changeIndices))\n\n        idx = bisect_left(range(len(ch)), True, key = allMarked)\n\n        return idx if allMarked(idx) else -1\n```\n[https://leetcode.com/problems/earliest-second-to-mark-indices-i/submissions/1196034938/](https://leetcode.com/problems/earliest-second-to-mark-indices-i/submissions/1196034938/)\n\n\n\nI could be wrong, but I think that time complexity is *O*(*N*log*N*) and space complexity is *O*(*N*), in which *N* ~ `len(nums)`.
['Python3']