func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n;     cin >> n;     long long k;     cin >> k;     long long arr[n + 1];     for (long long i = 1; i <= n; i++) {       cin >> arr[i];     }     set<long long> s;     for (long long i = k; i <= n; i++) {       s.insert(arr[i]);     }     if (s.size() != 1) {       cout << -1 << endl;     } else {       long long index = k;       while (index >= 1 && arr[index] == arr[k]) {         index--;       }       index++;       cout << index - 1 << endl;     }   }   