// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

int n, m;
int[] a;

void main() {
    scan(n, m);
    a = readln.split.to!(int[]);

    assert(n <= 200 && m <= 200);

    auto cnt = new int[](n + 1);
    a.each!(ai => cnt[ai]++);

    int xi, yi;

    foreach (i ; 0 .. m) {
        scan(xi, yi);
        xi--;

        cnt[a[xi]]--;
        cnt[yi]++;
        a[xi] = yi;

        debug {
            writeln("cnt:", cnt);
            writeln("a:", a);
        }

        int pos = n;
        int ans;

        while (pos > 0) {
            if (cnt[pos] == 0) {
                ans++;
                pos--;
            }
            else {
                pos -= cnt[pos];
            }
        }

        writeln(ans);
    }
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}