#BS0000003. Vị trí đầu và cuối của phần tử (Find First and Last Position)

Vị trí đầu và cuối của phần tử (Find First and Last Position)

Find First and Last Position of Element in Sorted Array

Source: LeetCode

Version: Phuoc Hung OJ Extended

Problem Statement

Given nn integers a0,a1,…,an−1a_0,a_1,\ldots,a_{n-1} sorted in non-decreasing order and target, find its first and last positions. If absent, print -1 -1. Indices start at 00. Required time: O(log⁡n)O(\log n).

Input

The first line contains nn and target. The second line contains nn non-decreasing integers; it may be empty when n=0n=0.

Output

Print first last, or -1 -1 if target is absent.

Subtasks

  • Subtask 1 — 20%: 0≤n≤1000\le n\le100.
  • Subtask 2 — 30%: 0≤n≤1040\le n\le10^4.
  • Subtask 3 — 50%: 0≤n≤1050\le n\le10^5, −109≤ai,target≤109-10^9\le a_i,\text{target}\le10^9.

Examples

Input

6 8
5 7 7 8 8 10

Output

3 4

Explanation

8 occurs from index 33 through index 44, so the result is 3 4.