#include <bits/stdc++.h>
using namespace std;
const long long MAX = 5e5;
long long N, Q, X, Y, res, cur, nxt, now, arr[MAX], prefix[MAX], seg[MAX],
    BIT[MAX];
void update(long long X, long long delta) {
  while (X <= N) {
    BIT[X] += delta;
    X += (X & -X);
  }
  return;
}
long long QuerySum(long long X) {
  long long res = 0;
  while (X > 0) {
    res += BIT[X];
    X -= (X & -X);
  }
  return res;
}
void build(long long low, long long high, long long node) {
  if (low == high) {
    seg[node] = arr[low];
    return;
  }
  long long mid = (low + high) / 2;
  build(low, mid, 2 * node);
  build(mid + 1, high, 2 * node + 1);
  seg[node] = max(seg[2 * node], seg[2 * node + 1]);
  return;
}
void update(long long low, long long high, long long node, long long idx) {
  if (low == high) {
    seg[node] = arr[low];
    return;
  }
  long long mid = (low + high) / 2;
  if (idx <= mid)
    update(low, mid, 2 * node, idx);
  else
    update(mid + 1, high, 2 * node + 1, idx);
  seg[node] = max(seg[2 * node], seg[2 * node + 1]);
  return;
}
long long QueryInd(long long low, long long high, long long node, long long sum,
                   long long ind) {
  if (low == high) return low;
  long long mid = (low + high) / 2;
  if (seg[2 * node] >= sum)
    return QueryInd(low, mid, 2 * node, sum, ind);
  else
    return QueryInd(mid + 1, high, 2 * node + 1, sum, ind);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin >> N >> Q;
  for (long long A = 1; A <= N; A++) {
    cin >> arr[A];
    update(A, arr[A]);
  }
  build(1, N, 1);
  while (Q--) {
    cin >> X >> Y;
    update(X, Y - arr[X]);
    arr[X] = Y;
    update(1, N, 1, X);
    if (arr[1] == 0) {
      cout << 1 << "\n";
      continue;
    }
    res = -1;
    cur = 1;
    while (cur < N) {
      nxt = QueryInd(1, N, 1, now = QuerySum(cur), cur);
      if (cur == nxt) {
        swap(arr[cur], arr[0]);
        update(1, N, 1, cur);
        nxt = QueryInd(1, N, 1, now = QuerySum(cur), cur);
        swap(arr[cur], arr[0]);
        update(1, N, 1, cur);
      }
      if (arr[nxt] < now) break;
      if (arr[nxt] == QuerySum(nxt - 1)) {
        res = nxt;
        break;
      }
      cur = nxt;
    }
    cout << res << "\n";
  }
  return 0;
}
