func_code_string: #include <bits/stdc++.h>   using namespace std;   int mark[100005];   long long msum[100005];   long long sum[100005];   int c[100005];   long long cs;   int main() {     long long ans = 0;     int i, n, m, x;     scanf( %d%d , &n, &m);     for (i = 1; i <= n; ++i) scanf( %d , &c[i]);     for (i = 1; i <= m; ++i) {       scanf( %d , &x);       mark[x] = 1;     }     for (i = n; i > 0; --i) {       sum[i] = sum[i + 1] + c[i];       msum[i] = msum[i + 1] + c[i] * mark[i];     }     for (i = 1; i <= n; ++i)       if (mark[i])         ans += c[i] * sum[i + 1];       else {         ans += c[i] * msum[i + 1];         if (!mark[i + 1]) ans += (long long)c[i] * c[i + 1];         if (i == 1 && !mark[n]) ans += (long long)c[i] * c[n];       }     printf( %I64d n , ans);     fclose(stdin);     fclose(stdout);     return 0;   }   