#include <bits/stdc++.h>
using namespace std;
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
const int IMAX = 1 << 18;
long long a[IMAX + 1], bit[IMAX + 1];
int n;
void update(int x, long long v) {
  long long dv = v - a[x];
  a[x] = v;
  for (; x <= IMAX; x += x & -x) bit[x] += dv;
}
long long getSum(int x) {
  long long sum = 0;
  for (; x > 0; x -= x & -x) sum += bit[x];
  return sum;
}
int getPos(long long v) {
  if (v >= bit[IMAX]) {
    return 1000000100;
  }
  long long p = 0, s = 0;
  for (int i = 17; i >= 0; i--) {
    if (s + bit[p + (1 << i)] <= v) {
      s += bit[p + (1 << i)];
      p |= (1 << i);
    }
  }
  return p + 1;
}
int main() {
  int q;
  cin >> n >> q;
  memset(a, 0, sizeof a);
  memset(bit, 0, sizeof bit);
  for (int i = 1; i <= n; i++) {
    long long temp;
    cin >> temp;
    update(i, temp);
  }
  while (q--) {
    long long p, x;
    cin >> p >> x;
    update(p, x);
    if (a[1] == 0) {
      cout << 1 << endl;
      continue;
    }
    long long cur = a[1];
    int ans = -1;
    while (1) {
      p = getPos(2 * cur - 1);
      if (p == 1000000100) break;
      x = getSum(p - 1);
      if (a[p] == x) {
        ans = p;
        break;
      }
      cur = x + a[p];
    }
    cout << ans << endl;
  }
}
