#P1371E1. Asterism (Easy Version)
Asterism (Easy Version)
Description
This is the easy version of the problem. The difference between versions is the constraints on and . You can make hacks only if all versions of the problem are solved.
First, Aoi came up with the following idea for the competitive programming problem:
Yuzu is a girl who collecting candies. Originally, she has candies. There are also enemies numbered with integers from to . Enemy has candies.
Yuzu is going to determine a permutation . A permutation is an array consisting of distinct integers from to in arbitrary order. For example, is a permutation, but is not a permutation ( appears twice in the array) and is also not a permutation (because but there is the number in the array).
After that, she will do duels with the enemies with the following rules:
- If Yuzu has equal or more number of candies than enemy , she wins the duel and gets candy. Otherwise, she loses the duel and gets nothing.
- The candy which Yuzu gets will be used in the next duels.
Yuzu wants to win all duels. How many valid permutations exist?
This problem was easy and wasn't interesting for Akari, who is a friend of Aoi. And Akari made the following problem from the above idea:
Let's define as the number of valid permutations for the integer .
You are given , and a prime number . Let's call a positive integer good, if the value is not divisible by . Find all good integers .
Your task is to solve this problem made by Akari.
The first line contains two integers , . It is guaranteed, that the number is prime (it has exactly two divisors and ).
The second line contains integers .
In the first line, print the number of good integers .
In the second line, output all good integers in the ascending order.
It is guaranteed that the number of good integers does not exceed .
Input
The first line contains two integers , . It is guaranteed, that the number is prime (it has exactly two divisors and ).
The second line contains integers .
Output
In the first line, print the number of good integers .
In the second line, output all good integers in the ascending order.
It is guaranteed that the number of good integers does not exceed .
Samples
Note
In the first test, .
- If , there are no valid permutations for Yuzu. So for all . The number is divisible by , so all integers are not good.
- If , is the only valid permutation for Yuzu. So , so the number is good.
- If , are all valid permutations for Yuzu. So , so the number is not good.
- If , all permutations are valid for Yuzu. So for all , so all integers are not good.
So, the only good number is .
In the third test, for all positive integers the value is divisible by .