Problem10269--CF EDU - Segment Tree P1 - Step 2 - C. First element at least X

10269: CF EDU - Segment Tree P1 - Step 2 - C. First element at least X

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

In this task, you need to add to the segment tree the operation of finding the minimum index $j$ such that $a[j]≥x$.

Input

The first line contains two integers $n, m\ (1≤n,m≤100,000)$, the size of the array and the number of operations. 
The next line contains $n$ numbers $a_i$, the initial state of the array $(0≤a_i≤10^9)$. 
The following lines contain the description of the operations. The description of each operation is as follows:
  • $\text{1 i v}$: change the item with index $i$ to $v\ (0≤i<n,\ 0≤v≤10^9)$.
  • $\text{2 x}$: find the minimum index $j$ such that $a[j]≥x$. If there is no such element, print −1. Indices start from 0.

Output

For each operation of the second type, print the answer for the query.

Sample 1 Input

5 7
1 3 2 4 6
2 2
2 5
1 2 5
2 4
2 8
1 3 7
2 6

Sample 1 Output

1
4
2
-1
3

HINT

CF EDU.

Source/Category