#include <bits/stdc++.h>
using namespace std;
const int MAXS = 1 << 19;
int seg[MAXS];
long long sum[MAXS];
void update(int sn, int s, int e, int p, int v) {
  if (s == e) {
    seg[sn] = v;
    sum[sn] = v;
    return;
  }
  int m = (s + e) / 2, lsn = sn * 2, rsn = sn * 2 + 1;
  if (p <= m)
    update(lsn, s, m, p, v);
  else
    update(rsn, m + 1, e, p, v);
  seg[sn] = max(seg[lsn], seg[rsn]);
  sum[sn] = sum[lsn] + sum[rsn];
}
int walk(int sn, int s, int e, int qs, long long v) {
  if (qs <= s) {
    if (seg[sn] < v) return e + 1;
  }
  if (s == e) return s;
  int m = (s + e) / 2, lsn = sn * 2, rsn = sn * 2 + 1, p;
  if (qs <= m) {
    p = walk(lsn, s, m, qs, v);
    if (p <= m) return p;
  }
  p = walk(rsn, m + 1, e, qs, v);
  return p;
}
long long query(int sn, int s, int e, int qs, int qe) {
  if (qs <= s && e <= qe) {
    return sum[sn];
  }
  int m = (s + e) / 2, lsn = sn * 2, rsn = sn * 2 + 1;
  long long ret = 0;
  if (qs <= m) ret += query(lsn, s, m, qs, qe);
  if (qe > m) ret += query(rsn, m + 1, e, qs, qe);
  return ret;
}
const int MAXN = 200005;
int A[MAXN];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &A[i]);
    update(1, 1, n, i, A[i]);
  }
  while (q--) {
    int p, x;
    scanf("%d%d", &p, &x);
    A[p] = x;
    update(1, 1, n, p, x);
    long long v = A[1];
    int ans = -1;
    if (!v) {
      ans = 1;
    } else {
      for (int i = 2; i <= n;) {
        int j = walk(1, 1, n, i, v);
        if (j > n) break;
        v = query(1, 1, n, 1, j - 1);
        if (A[j] == v) {
          ans = j;
          break;
        }
        v += A[j];
        i = j + 1;
      }
    }
    printf("%d\n", ans);
  }
}
