#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 5;
long long int arr[M];
long long int tree[M];
int n;
void update(int idx, long long int val) {
  while (idx <= n) {
    tree[idx] += val;
    idx += (idx & (-idx));
  }
}
long long int query(int idx) {
  long long int sum = 0;
  while (idx) {
    sum += tree[idx];
    idx -= (idx & (-idx));
  }
  return sum;
}
int search(int l, int r, long long int x) {
  if (l == r) {
    if (arr[l] == query(l - 1)) return l;
    if (l == n) return -1;
    return search(l + 1, n, 2 * query(l));
  }
  int mid = (l + r) / 2;
  long long int val = query(mid);
  if (val < x) return search(mid + 1, n, 2 * val);
  return search(l, mid, x);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q, i, p;
  long long int x;
  cin >> n >> q;
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
    update(i, arr[i]);
  }
  while (q--) {
    cin >> p >> x;
    update(p, x - arr[p]);
    arr[p] = x;
    cout << search(1, n, 0) << "\n";
  }
  return 0;
}
