#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, B = 450;
int pos[N], lef[N], rig[N], a[N], n;
struct node {
  long long vl;
  int id;
  friend bool operator<(node A, node B) { return A.vl < B.vl; }
};
struct block_ {
  node b[B];
  int len, tp;
  long long ts;
  void build(int p) {
    len = 0;
    ts = 0;
    for (register int i = (lef[p]); i <= (rig[p]); ++i) {
      if (a[i] >= ts) b[++len] = (node){a[i] - ts, i};
      ts += a[i];
    }
    sort(b + 1, b + 1 + len);
  }
  int query(long long nw) {
    tp = lower_bound(b + 1, b + 1 + len, (node){nw, 0}) - b;
    return (tp && tp <= len && b[tp].vl == nw) ? b[tp].id : -1;
  }
} t[B];
int ask() {
  long long nw = 0;
  int tp;
  for (register int i = (1); i <= (pos[n]); ++i) {
    tp = t[i].query(nw);
    if (tp != -1) return tp;
    nw += t[i].ts;
  }
  return -1;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q, x, y;
  cin >> n >> q;
  int blo = sqrt(n);
  for (register int i = (1); i <= (n); ++i)
    cin >> a[i], pos[i] = (i - 1) / blo + 1;
  for (register int i = (1); i <= (n); ++i) rig[pos[i]] = i;
  for (register int i = (n); i >= (1); --i) lef[pos[i]] = i;
  for (register int i = (1); i <= (pos[n]); ++i) t[i].build(i);
  while (q--) {
    cin >> x >> y;
    a[x] = y;
    t[pos[x]].build(pos[x]);
    cout << ask() << '\n';
  }
  return 0;
}
