func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     int n, k;     cin >> n >> k;     vector<int> a(n);     for (int &x : a) cin >> x;     bool can = true;     for (int i = k; i < n; ++i) {       if (a[i] != a[k - 1]) {         can = false;         break;       }     }     if (can) {       int head = k - 2;       while (head >= 0 && a[head] == a[k - 1]) head--;       cout << head + 1;     } else       cout << -1;     return 0;   }   