#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long inf = numeric_limits<long long>::max() / 2;
const long double eps = 1e-9;
const long double pi = acos(-1);
template <typename T>
inline bool mineq(T& a, T b) {
  return (a > b) ? (a = b, 1) : 0;
}
template <typename T>
inline bool maxeq(T& a, T b) {
  return (a < b) ? (a = b, 1) : 0;
}
inline void solve(), read();
const string file = "";
signed main() {
  if (file != "") {
    freopen((file + ".in").c_str(), "r", stdin);
    freopen((file + ".out").c_str(), "w", stdout);
  }
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  read();
  solve();
  return 0;
}
struct vertex {
  long long sum = 0;
  long long maxx = -inf;
};
struct segment {
  long long n;
  vector<vertex> t;
  segment() {}
  segment(vector<long long>& a) {
    long long l = log2((long long)((a).size())) + 1;
    n = 1ll << l;
    t.resize(2 * n);
    build(a);
  }
  vertex merge(vertex v1, vertex v2) {
    vertex v;
    v.sum = v1.sum + v2.sum;
    v.maxx = max(v1.maxx, v2.maxx);
    return v;
  }
  void build(vector<long long>& a) {
    for (long long i = 0; i < (long long)((a).size()); i++) {
      t[i + n].sum = t[i + n].maxx = a[i];
    }
    for (long long i = n - 1; i >= 0; i--) {
      t[i] = merge(t[2 * i], t[2 * i + 1]);
    }
  }
  long long get(long long v, long long tl, long long tr, long long l,
                long long r) {
    if (tl > r || tr < l) {
      return 0;
    }
    if (l <= tl && tr <= r) {
      return t[v].sum;
    }
    long long tm = (tl + tr) / 2;
    long long v1 = get(2 * v, tl, tm, l, r);
    long long v2 = get(2 * v + 1, tm + 1, tr, l, r);
    return v1 + v2;
  }
  long long down(long long v, long long tl, long long tr, long long l,
                 long long r, long long p) {
    if (tl > r || tr < l) {
      return -1;
    }
    if (t[v].maxx < p) {
      return -1;
    }
    if (tl == tr) {
      return tl;
    }
    long long tm = (tl + tr) / 2;
    long long v1 = down(2 * v, tl, tm, l, r, p);
    if (v1 != -1) {
      return v1;
    }
    long long v2 = down(2 * v + 1, tm + 1, tr, l, r, p);
    if (v2 != -1) {
      return v2;
    }
    return -1;
  }
  void upd(long long v, long long x) {
    v += n;
    t[v].maxx = t[v].sum = x;
    v /= 2;
    while (v >= 1) {
      t[v] = merge(t[2 * v], t[2 * v + 1]);
      v /= 2;
    }
  }
};
long long n, q;
vector<long long> a;
segment st;
long long get() {
  if (a[0] == 0) {
    return 0;
  }
  long long i = 0;
  long long p = st.get(1, 0, st.n - 1, 0, i);
  long long j = st.down(1, 0, st.n - 1, i + 1, n - 1, p);
  while (j != -1) {
    p = st.get(1, 0, st.n - 1, 0, j - 1);
    if (a[j] == p) {
      return j;
    }
    i = j;
    j = st.down(1, 0, st.n - 1, i + 1, n - 1, p);
  }
  return -2;
}
inline void solve() {
  st = segment(a);
  for (long long i = 0; i < q; i++) {
    long long p, x;
    cin >> p >> x;
    --p;
    a[p] = x;
    st.upd(p, x);
    long long ans = get() + 1;
    cout << ans << "\n";
  }
}
inline void read() {
  cin >> n >> q;
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
}
