output_description: Print M lines. The j-th line should contain the minimum necessary number of
  modifications of integers on the balls to make Snuke's objective achievable.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      A_1 A_2 ... A_N
      X_1 Y_1
      X_2 Y_2
      :
      X_M Y_M
attempt: input1 = list(map(int, input("").split(" ")))
  A = list(map(int, input("").split(" ")))
  N = input1[0]
  M = input1[1]
  temp = [input() for _ in range(M)]
  XY = [None] * M
  for i in range(M):
      XY[i] = list(map(int, temp[i].split(" ")))
  
  for j in range(M):
      A[XY[j][0] - 1] = XY[j][1]
      sorted(A, reverse=True)
      magic = [None] * N
      for ball in A:
          index = 1
          while (ball - index) >= 0:
              if magic[ball - index] == None:
                  magic[ball - index] = ball
                  break
              elif magic[ball - index] == ball:
                  index += 1
              else:
                  break
      print(magic.count(None))
  
problem_description: Statement
  
  There are N balls in a row. Initially, the i-th ball from the left has the
  integer A_i written on it.
  
  When Snuke cast a spell, the following happens:
  
    * Let the current number of balls be k. All the balls with k written on them disappear at the same time.
  
  Snuke's objective is to vanish all the balls by casting the spell some number
  of times. This may not be possible as it is. If that is the case, he would
  like to modify the integers on the minimum number of balls to make his
  objective achievable.
  
  By the way, the integers on these balls sometimes change by themselves. There
  will be M such changes. In the j-th change, the integer on the X_j-th ball
  from the left will change into Y_j.
  
  After each change, find the minimum number of modifications of integers on the
  balls Snuke needs to make if he wishes to achieve his objective before the
  next change occurs. We will assume that he is quick enough in modifying
  integers. Here, note that he does not actually perform those necessary
  modifications and leaves them as they are.
samples: [{"input": "5 3\n    1 1 3 4 5\n    1 2\n    2 5\n    5 4", "output": "0\n    1\n    1\n    \n\n  * After the first change, the integers on the balls become 2, 1, 3, 4, 5, from left to right. Here, all the balls can be vanished by casting the spell five times. Thus, no modification is necessary.\n  * After the second change, the integers on the balls become 2, 5, 3, 4, 5, from left to right. In this case, at least one modification must be made. One optimal solution is to modify the integer on the fifth ball from the left to 2, and cast the spell four times.\n  * After the third change, the integers on the balls become 2, 5, 3, 4, 4, from left to right. Also in this case, at least one modification must be made. One optimal solution is to modify the integer on the third ball from the left to 2, and cast the spell three times.\n\n* * *"}, {"input": "4 4\n    4 4 4 4\n    4 1\n    3 1\n    1 1\n    2 1", "output": "0\n    1\n    2\n    3\n    \n\n* * *"}, {"input": "10 10\n    8 7 2 9 10 6 6 5 5 4\n    8 1\n    6 3\n    6 2\n    7 10\n    9 7\n    9 9\n    2 4\n    8 1\n    1 8\n    7 7", "output": "1\n    0\n    1\n    2\n    2\n    3\n    3\n    3\n    3\n    2"}]