#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
enum { MOD0 = 1000000000, MOD7 = 1000000007, MOD9 = 1000000009 };
int a[200000];
long long ft[200000];
int t[800000];
int n;
void inc(int index, int val) {
  while (index < n) {
    ft[index] += val;
    index |= index + 1;
  }
}
long long sum(int r) {
  long long ret = 0;
  for (; r >= 0; r &= r + 1, --r) {
    ret += ft[r];
  }
  return ret;
}
long long sum(int l, int r) { return sum(r) - (l ? sum(l - 1) : 0); }
void build(int x = 0, int L = 0, int R = n - 1) {
  if (L == R) {
    t[x] = a[L];
    return;
  }
  int M = (L + R) / 2;
  build(2 * x + 1, L, M);
  build(2 * x + 2, M + 1, R);
  t[x] = max(t[2 * x + 1], t[2 * x + 2]);
}
void upd(int index, int val, int x = 0, int L = 0, int R = n - 1) {
  if (L == R) {
    t[x] = val;
    return;
  }
  int M = (L + R) / 2;
  if (index <= M) {
    upd(index, val, 2 * x + 1, L, M);
  } else {
    upd(index, val, 2 * x + 2, M + 1, R);
  }
  t[x] = max(t[2 * x + 1], t[2 * x + 2]);
}
int get(long long val, int from, int x = 0, int L = 0, int R = n - 1) {
  if (t[x] < val || R < from) {
    return n;
  } else if (L == R) {
    return L;
  }
  int M = (L + R) / 2;
  if (M < from) {
    return get(val, from, 2 * x + 2, M + 1, R);
  } else if (t[2 * x + 1] >= val) {
    int s = get(val, from, 2 * x + 1, L, M);
    if (s < n) {
      return s;
    }
  }
  return get(val, from, 2 * x + 2, M + 1, R);
}
int get_ans() {
  long long cur = 0;
  int index = 0;
  if (a[0] == 0) {
    return 1;
  }
  while (index < n) {
    cur += a[index];
    index = get(cur, index + 1);
    cur = sum(index - 1);
    if (a[index] == cur) {
      break;
    }
  }
  return index >= n ? -1 : index + 1;
}
int main() {
  int q;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    inc(i, a[i]);
  }
  build();
  while (q--) {
    int p, x;
    cin >> p >> x;
    --p;
    inc(p, x - a[p]);
    a[p] = x;
    upd(p, x);
    cout << get_ans() << '\n';
  }
  return 0;
}
