#include <bits/stdc++.h>
using namespace std;
vector<long long> tree, arr, diff;
int n, q;
long long sum(int k) {
  long long s = 0;
  while (k >= 1) {
    s += tree[k];
    k -= k & -k;
  }
  return s;
}
void add(int k, long long x) {
  while (k <= n) {
    tree[k] += x;
    k += k & -k;
  }
}
int binary_search(long long s) {
  long long l = 0, r = n + 1;
  while (l != r) {
    long long mid = (l + r) / 2;
    if (sum(mid) < s)
      l = mid + 1;
    else
      r = mid;
  }
  return l;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> q;
  tree.resize(n + 1);
  arr.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    add(i, arr[i]);
  }
  while (q--) {
    long long p, x;
    cin >> p >> x;
    add(p, x - arr[p]);
    arr[p] = x;
    if (tree[1] == 0)
      cout << 1 << endl;
    else {
      long long s = tree[1];
      while (1) {
        int index = binary_search(2 * s);
        if (index > n) {
          cout << -1 << endl;
          break;
        }
        s = sum(index);
        if (arr[index] * 2 == s) {
          cout << index << endl;
          break;
        }
      }
    }
  }
  return 0;
}
