#include <bits/stdc++.h>
using namespace std;
const int MN = 200010;
int N, Q;
int A[MN];
struct Fenwick {
  vector<long long> tree;
  void init() { tree = vector<long long>(N + 1, 0); }
  void upd(int idx, int val) {
    for (int i = idx + 1; i <= N; i += (i & -i)) tree[i] += val;
  }
  long long quer(int a) {
    long long ret = 0;
    for (int i = a + 1; i >= 1; i -= (i & -i)) ret += tree[i];
    return ret;
  }
  int kquer(long long k) {
    int ret = 0;
    for (int i = 20; i >= 0; i--) {
      if (ret + (1 << i) <= N && tree[ret + (1 << i)] < k)
        ret += (1 << i), k -= tree[ret];
    }
    return ret;
  }
} fw;
int main() {
  scanf("%d %d", &N, &Q);
  fw.init();
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    fw.upd(i, A[i]);
  }
  for (int i = 0; i < Q; i++) {
    int p, v;
    scanf("%d %d", &p, &v);
    p--;
    fw.upd(p, -A[p]);
    A[p] = v;
    fw.upd(p, A[p]);
    if (A[0] == 0) {
      printf("1\n");
      continue;
    }
    int pos = 0;
    bool f = false;
    while (pos < N - 1) {
      int nxt = fw.kquer(2 * fw.quer(pos));
      if (nxt == N) break;
      if (fw.quer(nxt) == 2 * fw.quer(nxt - 1)) {
        printf("%d\n", nxt + 1);
        f = true;
        break;
      }
      pos = nxt;
    }
    if (!f) {
      printf("-1\n");
    }
  }
}
