#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18 + 9;
const long long MAXN = 1e6 + 7;
const long long MAXN1 = 2e3 + 7;
const long long MOD = 1e9 + 7;
const long long ST = 157;
const long long ST1 = 199;
const long double EPS = 1e-9;
const long long BLOCK = 138;
void solve();
signed main() {
  srand('a' + 'l' + 'e' + 'x' + 'X' + '5' + '1' + '2');
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
pair<long long, long long> v[MAXN * 4];
long long fenv[MAXN];
void update(int vert, int tl, int tr, int ind, long long d) {
  if (tl == tr) {
    v[vert] = make_pair(d, ind);
    return;
  }
  int tm = (tl + tr) / 2;
  if (tm >= ind) {
    update(vert * 2, tl, tm, ind, d);
  } else {
    update(vert * 2 + 1, tm + 1, tr, ind, d);
  }
  v[vert] = max(v[vert * 2], v[vert * 2 + 1]);
}
int get(int vert, int tl, int tr, int l, long long k) {
  if (tl == tr) {
    if (v[vert].first >= k) {
      return v[vert].second;
    }
    return -1;
  }
  int tm = (tl + tr) / 2;
  if (v[vert * 2].first >= k && v[vert * 2].second > l) {
    get(vert * 2, tl, tm, l, k);
  } else {
    get(vert * 2 + 1, tm + 1, tr, l, k);
  }
}
void update_f(int x, int n, long long dop) {
  for (; x < n; x = (x | (x + 1))) {
    fenv[x] += dop;
  }
}
long long get_f(int x) {
  long long ans = 0;
  for (; x >= 0; x = (x & (x + 1)) - 1) {
    ans += fenv[x];
  }
  return ans;
}
void solve() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    update(1, 0, n - 1, i, a);
    update_f(i, n, a);
  }
  for (int i = 0; i < q; i++) {
    long long ind, x;
    cin >> ind >> x;
    update(1, 0, n - 1, ind - 1, x);
    update_f(ind - 1, n, x - get_f(ind - 1) + get_f(ind - 2));
    long long sum = 0;
    ind = -1;
    while (1) {
      int t = get(1, 0, n - 1, ind, sum);
      if (t == -1) {
        ind = t;
        break;
      }
      if (get_f(t - 1) * 2 == get_f(t)) {
        ind = t + 1;
        break;
      }
      sum = get_f(t);
      ind = t;
    }
    cout << ind << "\n";
  }
}
