func_code_string: #include <bits/stdc++.h>   const int mod = 1000000007;   using namespace std;   long long c[100005];   int v[100005];   set<int> s;   int n, k;   long long all, ans;   int main() {     scanf( %d %d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %I64d , &c[i]);     for (int i = 0; i < k; i++) scanf( %d , &v[i]);     all = 0;     ans = 0;     for (int i = 1; i <= n; i++) all += c[i];     for (int i = 1; i < n; i++) ans += c[i] * c[i + 1];     ans += c[n] * c[1];     s.clear();     for (int i = 0; i < k; i++) {       all -= c[v[i]];       s.insert(v[i]);       long long tmp = all;       if (v[i] < n && s.find(v[i] + 1) == s.end()) tmp -= c[v[i] + 1];       if (v[i] == n && s.find(1) == s.end()) tmp -= c[1];       if (v[i] > 1 && s.find(v[i] - 1) == s.end()) tmp -= c[v[i] - 1];       if (v[i] == 1 && s.find(n) == s.end()) tmp -= c[n];       ans += c[v[i]] * tmp;     }     printf( %I64d n , ans);   }   