#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, Q, A[100010], B[100010], C[100010], sum[100010];
  cin >> N >> Q;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < Q; i++) {
    cin >> B[i] >> C[i];
  }
  for (int i = 0; i < Q; i++) {
    for (int j = 0; j < N; j++) {
      if (A[j] == B[i]) {
        sum[i] += C[i];
      } else {
        sum[i] += A[j];
      }
    }
  }
  for (int i = 0; i < Q; i++) {
    cout << sum[i] << endl;
  }
}
