func_code_string: #include <bits/stdc++.h>   #pragma comment(linker,  /STACK:10240000 )   using namespace std;   const int MAXN = 100010;   int a[MAXN], cnt[MAXN];   int main() {     int n, k;     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     memset(cnt, 0, sizeof(cnt));     int sta = 1, num = 0;     while (num < k) {       if (cnt[a[sta]] == 0) {         num++;       }       cnt[a[sta]]++;       sta++;       if (sta > n) {         break;       }     }     if (num < k) {       printf( -1 -1 n );     } else {       int old = 1, l = 1, r = sta - 1;       int m = r - l + 1;       for (int i = sta; i <= n; i++) {         int j = old + 1;         cnt[a[old]]--;         if (j < i) {           while (a[j] == a[old]) {             cnt[a[old]]--;             j++;             if (j == i) {               break;             }           }         }         if (cnt[a[old]] == 0) {           num--;         }         old = j;         j = i;         while (num < k) {           if (cnt[a[j]] == 0) {             num++;           }           cnt[a[j]]++;           j++;           if (j > n) {             break;           }         }         if (num < k) {           break;         }         i = j - 1;         int tmp = i - old + 1;         if (tmp < m) {           m = tmp;           l = old;           r = i;         }       }       memset(cnt, 0, sizeof(cnt));       for (int i = l; i <= r; i++) {         cnt[a[i]]++;       }       while (cnt[a[l]] > 1) {         cnt[a[l]]--;         l++;       }       printf( %d %d n , l, r);     }     return 0;   }   