#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; const int B = 1000; int main() { cin.tie(0); ios::sync_with_stdio(0); int n, q; cin >> n >> q; int a[n * 2]; for (int i = 0; i < n; ++i) { cin >> a[i]; a[n + i] = a[i]; } int cnt[n] = {}; for (int i = 0; i < q; ++i) { int r; cin >> r; ++cnt[r]; } int b[n] = {}; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { b[j] += a[i + j] * cnt[i]; } } for (int i = 0; i < n; ++i) { cout << b[i] << (i < n - 1 ? ' ' : '\n'); } return 0; }