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>).
import sys
#sys.setrecursionlimit(10**7)
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))
############ ---- Input Functions ---- ############

def Array2():
    n,k = invr()
    sequence = inlt()

    count_dict = {}
    for element in sequence:
        if element not in count_dict.keys():
            count_dict[element] = 1
        else:
            count_dict[element] += 1
    
    if len(count_dict.keys()) < k:
        print(str(-1) + ' ' + str(-1))
    else:
        start_index = 0
        end_index = n-1 
        end_index_found = False 
        start_index_found = False 
        number_of_distinct_elements = len(count_dict.keys())

        for index in range(n-1,-1,-1):
            if end_index_found :
                break

            element = sequence[index]
            count_dict[element] -= 1

            if count_dict[element] == 0:
                number_of_distinct_elements -= 1

                if number_of_distinct_elements < k:
                    end_index = index
                    end_index_found = True 
        
        for index in range(n):
            if start_index_found: 
                break 

            element = sequence[index]
            count_dict[element] -= 1 

            if count_dict[element] == 0:
                number_of_distinct_elements -= 1

                if number_of_distinct_elements < k:
                    start_index = index
                    start_index_found = True 
        
        print(str(start_index+1) + ' ' + str(end_index+1))

Array2()