LogiQuest

405. Remove Element

EasyTwo Pointers

Remove every occurrence of val. Print the number of remaining elements, then the remaining elements in order (or EMPTY).

Input format

Line 1: n val Line 2: n integers

Output format

Line 1: count Line 2: the elements or EMPTY

Example 1

Input

4 3
3 2 2 3

Output

2
2 2

Example 2

Input

8 2
0 1 2 2 3 0 4 2

Output

5
0 1 3 0 4

Constraints

1 ≤ n ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…