#!python3
from collections import defaultdict

def main():
    n, m = map(int, input().split())
    last_read = defaultdict(lambda: -1)
    total_unread = 0

    for time in range(m):
        x = int(input())
        # everyone except x has one more unread message
        total_unread += n - 1

        # x reads this many messages
        total_unread -= time - last_read[x] - 1
        last_read[x] = time

        print(total_unread)

if __name__ == "__main__":
    main()
