#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int M = 1e6 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
long long mx[N << 2], sum[N << 2];
int n, q;
void update(int pos, int v, int l, int r, int rt) {
  if (l == r) {
    sum[rt] = v;
    mx[rt] = v;
    return;
  }
  int mid = l + r >> 1;
  if (pos <= mid)
    update(pos, v, l, mid, rt << 1);
  else
    update(pos, v, mid + 1, r, rt << 1 | 1);
  sum[rt] = sum[rt << 1] + sum[rt << 1 | 1];
  mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]);
}
long long getSum(int L, int R, int l, int r, int rt) {
  if (l >= L && r <= R) return sum[rt];
  int mid = l + r >> 1;
  long long ans = 0;
  if (L <= mid) ans += getSum(L, R, l, mid, rt << 1);
  if (R > mid) ans += getSum(L, R, mid + 1, r, rt << 1 | 1);
  return ans;
}
void getMxId(int L, int R, long long v, int l, int r, int rt, long long &ret,
             long long &id) {
  if (mx[rt] < v || id != -1) return;
  if (l == r) {
    id = l;
    ret = mx[rt];
    return;
  }
  int mid = l + r >> 1;
  if (L <= mid) getMxId(L, R, v, l, mid, rt << 1, ret, id);
  if (R > mid) getMxId(L, R, v, mid + 1, r, rt << 1 | 1, ret, id);
}
int cal() {
  if (getSum(1, 1, 1, n, 1) == 0) return 1;
  int now = 1;
  while (now < n) {
    long long sum = getSum(1, now, 1, n, 1), ret = -1, id = -1;
    getMxId(now + 1, n, sum, 1, n, 1, ret, id);
    if (id == -1) return -1;
    sum = getSum(1, id - 1, 1, n, 1);
    if (sum == ret) return id;
    now = id;
  }
  return -1;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    update(i, x, 1, n, 1);
  }
  while (q--) {
    int pos, v;
    scanf("%d%d", &pos, &v);
    update(pos, v, 1, n, 1);
    printf("%d\n", cal());
  }
  return 0;
}
