#include <bits/stdc++.h>
using namespace std;
long long n, q, a[200002], tree[200002];
set<long long> s[33];
void update(long long k, long long x) {
  while (k <= n) {
    tree[k] += x;
    k += k & -k;
  }
}
long long get(long long k) {
  long long ans = 0;
  while (k >= 1) {
    ans += tree[k];
    k -= k & -k;
  }
  return ans;
}
signed main() {
  scanf("%lld %lld", &n, &q);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    s[a[i] ? (long long)log2(a[i]) : 32].insert(i);
    update(i, a[i]);
  }
  while (q--) {
    long long p;
    scanf("%lld", &p);
    update(p, -a[p]);
    s[a[p] ? (long long)log2(a[p]) : 32].erase(p);
    scanf("%lld", &a[p]);
    update(p, a[p]);
    s[a[p] ? (long long)log2(a[p]) : 32].insert(p);
    if (a[1] == 0) {
      puts("1");
      continue;
    }
    long long ans = -1;
    for (long long i = 0; i <= 32; i++) {
      long long cnt = 0;
      for (auto z : s[i]) {
        cnt++;
        if (cnt > 3) break;
        long long temp = get(z - 1);
        if (temp == a[z]) {
          ans = z;
          goto lol;
        }
      }
    }
  lol:
    printf("%lld\n", ans);
  }
}
