#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
struct node {
  long long maxx;
  long long sum;
  int id;
} tree[maxn << 2];
int n, l, r;
int pos, flag;
long long a[maxn];
void build(int root, int s, int e) {
  if (s == e) {
    tree[root].maxx = a[s];
    tree[root].sum = tree[root].maxx;
    tree[root].id = s;
  } else {
    int mid = (s + e) >> 1;
    build(root << 1, s, mid);
    build(root << 1 | 1, mid + 1, e);
    tree[root].sum = tree[root << 1].sum + tree[root << 1 | 1].sum;
    if (tree[root << 1].maxx > tree[root << 1 | 1].maxx) {
      tree[root].maxx = tree[root << 1].maxx;
      tree[root].id = tree[root << 1].id;
    } else {
      tree[root].maxx = tree[root << 1 | 1].maxx;
      tree[root].id = tree[root << 1 | 1].id;
    }
  }
}
void Update(int root, int s, int e, int Index) {
  if (s == e) {
    tree[root].maxx = a[Index];
    tree[root].sum = tree[root].maxx;
  } else {
    int mid = (s + e) >> 1;
    if (Index <= mid)
      Update(root << 1, s, mid, Index);
    else
      Update(root << 1 | 1, mid + 1, e, Index);
    tree[root].sum = tree[root << 1].sum + tree[root << 1 | 1].sum;
    if (tree[root << 1].maxx > tree[root << 1 | 1].maxx) {
      tree[root].maxx = tree[root << 1].maxx;
      tree[root].id = tree[root << 1].id;
    } else {
      tree[root].maxx = tree[root << 1 | 1].maxx;
      tree[root].id = tree[root << 1 | 1].id;
    }
  }
}
void Find(int root, int s, int e, long long x) {
  if (tree[root].maxx >= x) {
    if (s == e) {
      pos = s;
      flag = 1;
    } else {
      int mid = (s + e) >> 1;
      if (tree[root << 1].maxx >= x && tree[root << 1].id > pos) {
        Find(root << 1, s, mid, x);
      } else if (tree[root << 1 | 1].id > pos) {
        Find(root << 1 | 1, mid + 1, e, x);
      }
    }
  }
}
long long Findsum(int root, int s, int e) {
  if (l <= s && e <= r) {
    return tree[root].sum;
  } else if (s > r)
    return 0;
  else if (e < l)
    return 0;
  int mid = (s + e) >> 1;
  return Findsum(root << 1, s, mid) + Findsum(root << 1 | 1, mid + 1, e);
}
int main() {
  int q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  build(1, 1, n);
  while (q--) {
    int Index;
    long long x;
    scanf("%d%lld", &Index, &x);
    a[Index] = x;
    Update(1, 1, n, Index);
    int res = 0;
    long long sum = 0;
    pos = 0;
    while (true) {
      flag = 0;
      Find(1, 1, n, sum);
      if (!flag) {
        break;
      } else if (pos == 1) {
        if (sum == a[1]) {
          res = 1;
          break;
        } else
          sum = a[1];
      } else {
        l = 1;
        r = pos - 1;
        sum = Findsum(1, 1, n);
        if (sum == a[pos]) {
          res = pos;
          break;
        } else
          sum += a[pos];
      }
    }
    if (res) {
      printf("%d\n", res);
    } else
      printf("-1\n");
  }
  return 0;
}
