#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 233;
long long ch[maxn];
int n, a[maxn];
set<int> ord[50];
inline void add(int x) {
  for (int i = x; i <= n; i += i & (-i)) ch[i] += a[x];
  if (a[x] == 0) return;
  int l = 1;
  while ((1 << l) < a[x]) l++;
  ord[l].insert(x);
}
inline void remove(int x) {
  for (int i = x; i <= n; i += i & (-i)) ch[i] -= a[x];
  if (a[x] == 0) return;
  int l = 1;
  while ((1 << l) < a[x]) l++;
  ord[l].erase(x);
}
inline bool check(int x) {
  long long sum = 0;
  for (int i = x - 1; i; i -= i & (-i)) sum += ch[i];
  if (sum == a[x]) return 1;
  return 0;
}
inline int find() {
  if (a[1] == 0) return 1;
  set<int>::iterator it;
  for (int i = 1; i <= 30; i++) {
    it = ord[i].begin();
    if (it == ord[i].end()) continue;
    if (check(*it)) return *it;
    ++it;
    if (it == ord[i].end()) continue;
    if (check(*it)) return *it;
  }
  return -1;
}
int main() {
  int q;
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    add(i);
  }
  for (int i = 1; i <= q; i++) {
    int p, v;
    scanf("%d%d", &p, &v);
    remove(p);
    a[p] = v;
    add(p);
    printf("%d\n", find());
  }
  return 0;
}
