#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; using P = pair; const long long LM = 1LL << 60; int main() { cin.tie(0); ios::sync_with_stdio(0); int n, q; cin >> n >> q; int a[200010] = {}; for (int i = 0; i < n; ++i) { cin >> a[i]; a[i + n] = a[i]; } int cnt[100010] = {}; for (int i = 0; i < q; ++i) { int x; cin >> x; ++cnt[x]; } for (int i = 0; i < n; ++i) { int b = 0; for (int j = 0; j < n; ++j) { b += cnt[j] * a[i + j]; } cout << b << (i + 1 < n ? ' ' : '\n'); } return 0; }