#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 233;
long long ch[maxn];
int n, q, a[maxn];
inline void add(int x, int v) {
  for (int i = x; i <= n; i += i & (-i)) ch[i] += v;
}
long long query(int x) {
  long long sum = 0;
  for (int i = x; i; i -= i & (-i)) sum += ch[i];
  return sum;
}
int find(long long v) {
  int x = 0;
  for (int i = 20; i >= 0; i--)
    if (x + (1 << i) <= n && ch[x + (1 << i)] < v) {
      x += 1 << i;
      v -= ch[x];
    }
  return x;
}
int find() {
  if (a[1] == 0) return 1;
  long long sum = a[1];
  int last = 1;
  while (sum <= 1e9) {
    if (a[last + 1] == sum) return last + 1;
    int tmp = find(sum * 2);
    if (tmp == last)
      last++;
    else
      last = tmp;
    sum = query(last);
    if (last >= n) return -1;
  }
  return -1;
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    add(i, a[i]);
  }
  for (int i = 1; i <= q; i++) {
    int p, v;
    scanf("%d%d", &p, &v);
    add(p, -a[p]);
    a[p] = v;
    add(p, a[p]);
    printf("%d\n", find());
  }
  return 0;
}
