func_code_string: #include <bits/stdc++.h>   using namespace std;   int N, K, M, S;   int arr[500000];   int raito[500005];   int seen[500005];   int bucket[500005];   int shift[500005];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> M >> K >> N >> S;     for (int i = 0; i < M; i++) {       cin >> arr[i];     }     int t;     for (int i = 0; i < S; i++) {       cin >> t;       bucket[t]++;     }     for (int i = 0; i < 500005; i++) seen[i] = -1;     for (int i = M - 1; i >= 0; i--) {       raito[i] = seen[arr[i]];       seen[arr[i]] = i;     }     int maxima = 0;     for (int i = 0; i < 500005; i++) {       if (bucket[i] == 0) continue;       int cur = seen[i];       int p = 1;       while (cur != -1 && p < bucket[i]) {         cur = raito[cur];         p++;       }       if (cur == -1) {         cout << -1;         return 0;       }       shift[i] = cur;       maxima = max(maxima, cur);     }     vector<int> adj;     for (int i = 0; i < M;) {       int total = i / K + 1 + ((M - 1) - (maxima + 1) + 1) / K;       if (total >= N) {         int extra = K - S;         for (int j = i; j <= maxima; j++) {           if (extra <= 0 && bucket[arr[j]] == 0) {             adj.push_back(j + 1);           } else if (bucket[arr[j]] == 0) {             extra--;           } else {             bucket[arr[j]]--;           }         }         cout << adj.size() <<   n ;         for (int j = 0; j < adj.size(); j++) {           cout << adj[j] <<    ;         }         return 0;       }       if (i + 1 == M) break;       int pp = 0;       if (bucket[arr[i]] != 0) {         shift[arr[i]] = raito[shift[arr[i]]];         maxima = max(maxima, shift[arr[i]]);         if (shift[arr[i]] == -1) {           cout << -1;           return 0;         }       }       i++;     }     cout << -1;     return 0;   }   