func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     k--;     int a[n];     int sum = 0;     for (int i = 0; i < n; ++i) {       cin >> a[i];     }     if (a[k] == 1) sum++;     for (int i = 1; i < n; ++i) {       if (k - i < 0) {         for (int j = k + i; j < n; ++j) {           sum += a[j];         }         break;       }       if (k + i >= n) {         for (int j = k - i; j >= 0; --j) {           sum += a[j];         }         break;       }       if (a[k - i] == 1 && a[k + i] == 1) sum += 2;     }     cout << sum;     return 0;   }   