#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5;
long long A[maxn + 5];
long long T[maxn + 5];
void add(long long x, long long v) {
  for (; x <= maxn; x += (x & -x)) {
    T[x] += v;
  }
}
long long ask(long long x) {
  long long ans = 0;
  for (; x; x -= (x & -x)) {
    ans += T[x];
  }
  return ans;
}
set<long long> G[35];
long long d[maxn + 5];
long long p[maxn + 5];
bool f[maxn + 5];
long long n, q;
signed main() {
  scanf("%lld", &(n));
  scanf("%lld", &(q));
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &(A[i]));
    p[i + 1] = A[i] + p[i];
    add(i, A[i]);
  }
  for (long long i = 1; i <= n; i++) {
    long long x = A[i];
    while (x) {
      d[i]++;
      x /= 2;
    }
    G[d[i]].insert(i);
  }
  for (long long i = 0; i <= 32; i++) {
    long long o = 0;
    for (auto j : G[i]) {
      f[j] = true;
      o++;
      if (o == 2) {
        break;
      }
    }
  }
  long long x, y;
  long long ans, t;
  while (q--) {
    scanf("%lld", &(x));
    scanf("%lld", &(y));
    add(x, y - A[x]);
    t = y - A[x];
    ans = -1;
    A[x] = y;
    G[d[x]].erase(x);
    d[x] = 0;
    while (y) {
      d[x]++;
      y /= 2;
    }
    f[x] = false;
    long long oo = 0;
    for (auto i : G[d[x]]) {
      oo++;
      if (oo == 2) {
        if (i > x) f[i] = false;
        break;
      }
    }
    G[d[x]].insert(x);
    for (long long i = 0; i <= 32; i++) {
      long long o = 0;
      for (auto j : G[i]) {
        if (f[j]) {
          if (j > x) {
            p[j] += t;
          }
        } else {
          f[j] = true;
          p[j] = ask(j - 1);
        }
        if (ans == -1 && A[j] == p[j]) {
          ans = j;
        }
        o++;
        if (o == 2) break;
      }
    }
    cout << ans << '\n';
  }
}
