

実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 200 点
問題文
長さ M の整数列 A=(A_1,A_2,\dots,A_M) が与えられます。
A の各要素は 1 以上 N 以下で、全ての要素は相異なります。
A の要素として含まれない 1 以上 N 以下の整数を、昇順に全て列挙してください。
制約
- 入力は全て整数
- 1 \le M \le N \le 1000
- 1 \le A_i \le N
- A の要素は相異なる
入力
入力は以下の形式で標準入力から与えられる。
N M A_1 A_2 \dots A_M
出力
A の要素として含まれない 1 以上 N 以下の整数を昇順に全て挙げた列が (X_1,X_2,\dots,X_C) であるとき、以下の形式で出力せよ。
C X_1 X_2 \dots X_C
入力例 1
10 3 3 9 2
出力例 1
7 1 4 5 6 7 8 10
A=(3,9,2) です。
A の要素として含まれない 1 以上 10 以下の整数を昇順に全て挙げると、 1,4,5,6,7,8,10 となります。
入力例 2
6 6 1 3 5 2 4 6
出力例 2
0
A の要素として含まれない 1 以上 6 以下の整数がひとつもありません。
この場合、 1 行目に 0
と出力し、 2 行目は空行としてください。
入力例 3
9 1 9
出力例 3
8 1 2 3 4 5 6 7 8
Score : 200 points
Problem Statement
You are given a sequence of M integers A = (A_1, A_2, \dots, A_M).
Each element of A is an integer between 1 and N, inclusive, and all elements are distinct.
List all integers between 1 and N that do not appear in A in ascending order.
Constraints
- All input values are integers.
- 1 \le M \le N \le 1000
- 1 \le A_i \le N
- The elements of A are distinct.
Input
The input is given from Standard Input in the following format:
N M A_1 A_2 \dots A_M
Output
Let (X_1, X_2, \dots, X_C) be the sequence of all integers between 1 and N, inclusive, that do not appear in A, listed in ascending order. The output should be in the following format:
C X_1 X_2 \dots X_C
Sample Input 1
10 3 3 9 2
Sample Output 1
7 1 4 5 6 7 8 10
Here, A=(3,9,2).
The integers between 1 and 10 that do not appear in A, listed in ascending order, are 1,4,5,6,7,8,10.
Sample Input 2
6 6 1 3 5 2 4 6
Sample Output 2
0
No integer between 1 and 6 is missing from A.
In this case, print 0
on the first line and leave the second line empty.
Sample Input 3
9 1 9
Sample Output 3
8 1 2 3 4 5 6 7 8