#include <bits/stdc++.h>
using namespace std;
const long long neutral = 0;
long long comp(long long a, long long b) { return a + b; }
class SegmentTree {
  vector<long long> a;
  int n;

 public:
  SegmentTree() {}
  SegmentTree(long long* st, long long* en) {
    int sz = int(en - st);
    for (n = 1; n < sz; n <<= 1)
      ;
    a.assign(n << 1, neutral);
    for (int i = 0; i < sz; i++) a[i + n] = st[i];
    for (int i = n + sz - 1; i; i--) a[i >> 1] = comp(a[i >> 1], a[i]);
  }
  void update(int i, long long x) {
    a[i + n] = x;
    for (i += n, i >>= 1; i; i >>= 1) a[i] = comp(a[i << 1], a[1 + (i << 1)]);
  }
  long long query(int l, int r) {
    if (l > r) return neutral;
    long long ans = neutral;
    for (l += n, r += n + 1; l < r; l >>= 1, r >>= 1) {
      if (l & 1) ans = comp(ans, a[l++]);
      if (r & 1) ans = comp(ans, a[--r]);
    }
    return ans;
  }
};
set<pair<int, int> > bit[60];
long long a[200309];
int getBit(long long x) {
  int ans = 0, cnt = 0;
  while (x > 0) {
    cnt++;
    if (x & 1) ans = cnt;
    x >>= 1;
  }
  return ans;
}
SegmentTree st;
int getZero() {
  for (int b = 0; (b) < int(60); (b)++) {
    if (bit[b].size() >= 1u) {
      int i = bit[b].begin()->first;
      if (st.query(0, i - 1) == a[i]) return i + 1;
    }
    if (bit[b].size() >= 2u) {
      int i = (++bit[b].begin())->first;
      if (st.query(0, i - 1) == a[i]) return i + 1;
    }
  }
  return -1;
}
int main() {
  int n, q;
  scanf("%d %d", &n, &q);
  for (int i = 0; (i) < int(n); (i)++) {
    scanf("%lld", &a[i]);
    bit[getBit(a[i])].insert(pair<int, int>(i, a[i]));
  }
  st = SegmentTree(a, a + n);
  for (int j = 0; (j) < int(q); (j)++) {
    int i;
    long long x;
    scanf("%d %lld", &i, &x);
    i--;
    bit[getBit(a[i])].erase(pair<int, int>(i, a[i]));
    a[i] = x;
    st.update(i, x);
    bit[getBit(a[i])].insert(pair<int, int>(i, a[i]));
    printf("%d\n", getZero());
  }
  return 0;
}
