Missing Element In Sorted Array

easy
Given an integer array nums which is sorted in ascending order and all of its elements are unique and given also an integer k, return the kth missing number starting from the leftmost number of the array.

Input Format

Integer Array of size n Integer k

Output Format

Integer val

Constraints

1 <= nums.length <= 5 * 104
1 <= nums[i] <= 107
nums is sorted in ascending order, and all the elements are unique.
1 <= k <= 108

Notice

NA

Example

Input
4
4 7 9 10
3
Output
8
Previous
Divide Given Bst
Next
Find The Longest Substring Containing Vowels In Even Counts

Related Questions