MoEngage has given you an array
consisting of positive integers.
You should perform queries of the following two types:
- : Set to .
- : Find the minimum non-negative integer such that the sequence is sorted in non-decreasing order. Print if no such exists.
For each query of type , output the minimum non-negative integer satisfying the constraint, or if there isn't any.
Input Format
- The first line contains two integers .
- The second line contains space-separated integers .
- Then, the of the next lines contains three integers describing the queries or .
Output Format
For each query of type , output the minimum integer satisfying the constraint, or if there isn't any in a new line.
Constraints
Sample Input 1
5 7
5 3 2 6 0
2 1 5
1 2 7
2 1 5
1 4 2
2 1 5
1 2 5
2 1 2
Sample Output 1
4
-1
5
0
Explanation
In the first query, selecting makes the sequence satisfying this.
In the second query, change . After the second query, the array becomes .
In the third query, there exists no value of satisfying the constraints.
ConversionConversion EmoticonEmoticon