#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
template <class T>
struct SegmentTreeSum {
  T it[N << 2];
  T lazy[N << 3];
  void Init() {
    memset(it, 0, sizeof it);
    memset(lazy, 0, sizeof lazy);
  }
  void push(int x, int l, int r) {
    it[x] += lazy[x] * (r - l + 1);
    lazy[x + x] += lazy[x];
    lazy[x + x + 1] += lazy[x];
    lazy[x] = 0;
  }
  void update(int x, int l, int r, int u, int v, T val) {
    if (v < u) return;
    push(x, l, r);
    if (l > v || r < u) return;
    if (l >= u && r <= v) {
      lazy[x] += val;
      push(x, l, r);
      return;
    }
    update(x + x, l, ((l + r) >> 1), u, v, val);
    update(x + x + 1, ((l + r) >> 1) + 1, r, u, v, val);
    it[x] = it[x + x] + it[x + x + 1];
  }
  void modify(int x, int l, int r, int pos, T val) {
    push(x, l, r);
    if (l > pos || r < pos) return;
    if (l == r) {
      it[x] = val;
      return;
    }
    modify(x + x, l, ((l + r) >> 1), pos, val);
    modify(x + x + 1, ((l + r) >> 1) + 1, r, pos, val);
    it[x] = it[x + x] + it[x + x + 1];
  }
  T query(int x, int l, int r, int u, int v) {
    push(x, l, r);
    if (u > v) return 0;
    if (l > v || r < u) return 0;
    if (l >= u && r <= v) return it[x];
    T ret = query(x + x, l, ((l + r) >> 1), u, v) +
            query(x + x + 1, ((l + r) >> 1) + 1, r, u, v);
    it[x] = it[x + x] + it[x + x + 1];
    return ret;
  }
};
struct SegmentTreeMax {
  int it[N << 2];
  int lazy[N << 3];
  void modify(int x, int l, int r, int pos, int val) {
    if (l > pos || r < pos) return;
    if (l == r) {
      it[x] = val;
      return;
    }
    modify(x + x, l, ((l + r) >> 1), pos, val);
    modify(x + x + 1, ((l + r) >> 1) + 1, r, pos, val);
    it[x] = max(it[x + x], it[x + x + 1]);
  }
  int fin(int x, int l, int r, int k, int pos) {
    if (r <= pos) return -1;
    if (it[x] < k) return -1;
    if (l == r) return r;
    if (l > pos) {
      if (it[x + x] >= k) return fin(x + x, l, ((l + r) >> 1), k, pos);
      return fin(x + x + 1, ((l + r) >> 1) + 1, r, k - it[x + x], pos);
    }
    int ans = fin(x + x, l, ((l + r) >> 1), k, pos);
    if (ans != -1) return ans;
    return fin(x + x + 1, ((l + r) >> 1) + 1, r, k, pos);
  }
} smt;
SegmentTreeSum<long long> sum;
int n, q;
int a[N];
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    a[i] = x;
    smt.modify(1, 1, n, i, x);
    sum.modify(1, 1, n, i, x);
  }
  while (q--) {
    int p, x;
    scanf("%d%d", &p, &x);
    a[p] = x;
    smt.modify(1, 1, n, p, x);
    sum.modify(1, 1, n, p, x);
    if (a[1] == 0) {
      puts("1");
      continue;
    }
    int pos = 0, cnt = 0;
    while (true) {
      long long x = sum.query(1, 1, n, 1, pos);
      if (x > 1000000000) {
        pos = -1;
        break;
      }
      int k = smt.fin(1, 1, n, x, pos);
      if (k == -1) {
        pos = -1;
        break;
      }
      long long y = sum.query(1, 1, n, 1, k - 1);
      if (y == sum.query(1, 1, n, k, k)) {
        pos = k;
        break;
      }
      pos = k;
    }
    printf("%d\n", pos);
  }
  return 0;
}
