#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long mx[N * 4], s[N * 4];
int n, q;
long long a[N];
void pushup(int x) {
  mx[x] = max(mx[x + x + 1], mx[x + x + 2]);
  s[x] = s[x + x + 1] + s[x + x + 2];
}
void build(int x, int l, int r) {
  if (l > r) return;
  if (l == r) {
    mx[x] = s[x] = a[l];
    return;
  }
  int mid = l + r >> 1;
  build(x + x + 1, l, mid);
  build(x + x + 2, mid + 1, r);
  pushup(x);
}
void upd(int x, int l, int r, int id, int t) {
  if (l > r) return;
  if (l > id || r < id) return;
  if (l == r) {
    mx[x] = s[x] = t;
    return;
  }
  int mid = l + r >> 1;
  upd(x + x + 1, l, mid, id, t);
  upd(x + x + 2, mid + 1, r, id, t);
  pushup(x);
}
long long query(int x, int l, int r, int L, int R) {
  if (l > r || L > r || l > R) return 0;
  if (L <= l && r <= R) {
    return s[x];
  }
  int mid = l + r >> 1;
  return query(x + x + 1, l, mid, L, R) + query(x + x + 2, mid + 1, r, L, R);
}
int find(int x, int l, int r, int L, int R, long long sum) {
  if (l > r || L > r || l > R) return -1;
  if (l == r) return l;
  int mid = l + r >> 1;
  int ret = -1;
  if (L <= mid && mx[x + x + 1] >= sum)
    ret = find(x + x + 1, l, mid, L, R, sum);
  if (ret != -1) return ret;
  if (R > mid && mx[x + x + 2] >= sum)
    ret = find(x + x + 2, mid + 1, r, L, R, sum);
  return ret;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  build(0, 1, n);
  while (q--) {
    int id;
    long long x;
    scanf("%d%I64d", &id, &x);
    upd(0, 1, n, id, x);
    a[id] = x;
    if (a[1] == 0) {
      puts("1");
      continue;
    }
    int l = 1, r = n;
    while (1) {
      long long sum = query(0, 1, n, 1, l);
      id = find(0, 1, n, l + 1, n, sum);
      if (id == -1) {
        puts("-1");
        break;
      }
      sum = query(0, 1, n, 1, id - 1);
      if (a[id] == sum) {
        printf("%d\n", id);
        break;
      } else
        l = id;
    }
  }
  return 0;
}
