#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int M = 800;
int a[N];
int start[M];
int term[M];
long long int sum[M];
unordered_map<long long int, int> need[M];
void resolve(int idx) {
  long long int prefix = 0;
  need[idx].clear();
  for (int i = start[idx]; i < term[idx]; i++) {
    long long int need_num = a[i] - prefix;
    if (need_num >= 0) {
      need[idx].emplace(need_num, i + 1);
    }
    prefix += a[i];
  }
  sum[idx] = prefix;
}
int n, m, q;
int find_key(int idx, long long int key) {
  auto x = need[idx].find(key);
  if (x == need[idx].end()) return -1;
  return x->second;
}
int find(int t, int x) {
  long long int prefix = 0;
  int found = -1;
  a[t] = x;
  for (int i = 0; i < m; i++) {
    if (term[i] > t) {
      resolve(i);
      if (found != -1) break;
      for (int j = i; j < m; j++) {
        found = find_key(j, prefix);
        if (found != -1) {
          break;
        }
        prefix += sum[j];
      }
      break;
    } else {
      if (found == -1) {
        found = find_key(i, prefix);
      }
      prefix += sum[i];
    }
  }
  return found;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> q;
  int sq = sqrt(n);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[i] = x;
  }
  int idx = 0;
  m = 0;
  while (idx < n) {
    int n_idx = min(idx + sq, n);
    start[m] = idx;
    term[m] = n_idx;
    m++;
    idx = n_idx;
  }
  for (int i = 0; i < m; i++) {
    resolve(i);
  }
  for (int i = 0; i < q; i++) {
    int t;
    long long int x;
    cin >> t >> x;
    cout << find(t - 1, x) << "\n";
  }
}
