#include
using namespace std;
int n,q,a,even = 0,odd = 0,c,x; long long s = 0;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> q;
for (int i = 0; i < n; i++) {
cin >> a;
s = s + a;
if (a % 2 == 0) even++;
else odd++;
}
for (int i = 0; i < q; i++) {
cin >> c >> x;
if (!c) {
s = s + even*x;
if (x % 2 != 0) {
odd = odd + even;
even = 0;
}
} else {
s = s + odd*x;
if (x % 2 != 0) {
even = odd + even;
odd = 0;
}
}
cout << s << '\n';
}
return 0;
}