You've got an array *a*, consisting of *n* integers: *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. Your task is to find a minimal by inclusion segment [*l*, *r*] (1 ≤ *l* ≤ *r* ≤ *n*) such, that among numbers *a*<sub class="lower-index">*l*</sub>,  *a*<sub class="lower-index">*l* + 1</sub>,  ...,  *a*<sub class="lower-index">*r*</sub> there are exactly *k* distinct numbers.

Segment [*l*, *r*] (1 ≤ *l* ≤ *r* ≤ *n*; *l*, *r* are integers) of length *m* = *r* - *l* + 1, satisfying the given property, is called minimal by inclusion, if there is no segment [*x*, *y*] satisfying the property and less then *m* in length, such that 1 ≤ *l* ≤ *x* ≤ *y* ≤ *r* ≤ *n*. Note that the segment [*l*, *r*] doesn't have to be minimal in length among all segments, satisfying the given property.
The first line contains two space-separated integers: *n* and *k* (1 ≤ *n*, *k* ≤ 10<sup class="upper-index">5</sup>). The second line contains *n* space-separated integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> — elements of the array *a* (1 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">5</sup>).

def generate_mang(list_a,k):
    result = [list_a[0]]
    disctint_list = list(set(list_a))
    if(len(disctint_list) < k):
        return "-1 -1"
    for i in range(1, len(list_a)):
        if(k == 1):
            return result
        while k > 1:
            if (list_a[i] not in result):
                k = k - 1
            result.append(list_a[i])
            break
    return result
def array_min(arr):
    result =[]
    if arr == "-1 -1":
        return "-1 -1"
    else:
        result.append(arr[0])
        for i in range(1,len(arr)):
            while (arr[i]!= arr[0] and arr[i] != arr[-1]):
                result.append(arr[i])
                break
        result.append(arr[-1])
        return result




n, k = map(int, input().split())

list_n = list(map(int,input().split())

print(array_min(generate_mang(list_n,k)))

