#include <bits/stdc++.h>
using namespace std;
const int N = 105, inf = 1e9 + 7, MOD = 1e9 + 7;
const long long INF = 2e18 + 7;
const int M = 1 << 18;
int sumTree[2 * M];
int maxTree[2 * M];
void build() {
  for (int i = M - 1; i > 0; --i) {
    sumTree[i] = min(inf, sumTree[2 * i] + sumTree[2 * i + 1]);
    maxTree[i] = max(maxTree[2 * i], maxTree[2 * i + 1]);
  }
}
void setVal(int v, int val) {
  v += M;
  sumTree[v] = val;
  maxTree[v] = val;
  while (v > 1) {
    v /= 2;
    sumTree[v] = min(inf, sumTree[2 * v + 1] + sumTree[2 * v]);
    maxTree[v] = max(maxTree[2 * v], maxTree[2 * v + 1]);
  }
}
int sumQuerry(int a, int b) {
  a += M;
  b += M;
  int res = sumTree[a];
  if (a != b) res += sumTree[b];
  res = min(res, inf);
  while (a / 2 != b / 2) {
    if (!(a & 1)) res = min(inf, res + sumTree[a + 1]);
    if (b & 1) res = min(inf, res + sumTree[b - 1]);
    a >>= 1;
    b >>= 1;
  }
  return res;
}
int findLowerBound(int v, int val) {
  while (v < M) {
    if (maxTree[2 * v] >= val)
      v = 2 * v;
    else
      v = 2 * v + 1;
  }
  return v - M;
}
int lowerBound(int a, int b, int val) {
  vector<int> nodesReversed;
  a += M;
  b += M;
  nodesReversed.reserve(18);
  if (maxTree[a] >= val) return findLowerBound(a, val);
  if (a != b) nodesReversed.push_back(b);
  while (a / 2 != b / 2) {
    if (!(a & 1) && maxTree[a + 1] >= val) return findLowerBound(a + 1, val);
    if (b & 1) nodesReversed.push_back(b - 1);
    a >>= 1;
    b >>= 1;
  }
  reverse(nodesReversed.begin(), nodesReversed.end());
  for (auto& u : nodesReversed) {
    if (maxTree[u] >= val) {
      return findLowerBound(u, val);
    }
  }
  return -1;
}
int n;
int getShaman() {
  int sum = 0;
  int index = -1;
  while (index < n && sum <= maxTree[1]) {
    index = lowerBound(index + 1, M - 1, sum);
    if (index == -1) return -1;
    if (index > 0) sum = sumQuerry(0, index - 1);
    if (sum == maxTree[index + M]) return index + 1;
    sum += maxTree[index + M];
  }
  return -1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    cin >> sumTree[i + M];
    maxTree[i + M] = sumTree[i + M];
  }
  build();
  int last = -1;
  while (q--) {
    int pos, val;
    cin >> pos >> val;
    --pos;
    setVal(pos, val);
    if (last >= pos || last == -1) {
      last = getShaman();
    }
    cout << last << '\n';
  }
  return 0;
}
