Povjerenstvo

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

Do you know how hard it is to choose a set of people for the problem selection committee? No? Well do you know who does? Mr. Malnar, of course. By observing human interactions, the all-knowing Mr. Malnar has decided what the ideal choice should look like.

A total of NN people are being considered for the committee and MM relations between them have been recorded. A relation is described by an ordered pair (a,b)(a, b) representing the fact that person aa dislikes person bb. Mr. Malnar defines a dislike circle to be a sequence of distinct people x_1,x_2,,x_kx\_1, x\_2, \dots , x\_k such that person x_ix\_i dislikes person x_i+1x\_{i+1}, for each 1ik1 ≤ i ≤ k (it is assumed that x_k+1=x_1x\_{k+1} = x\_1). Mr. Malnar noticed a peculiar property regarding the set of people in question: there is no dislike circle consisting of an odd number of people.

To minimize dissatisfaction with the choice of committee, Mr. Malnar is looking for a committee such that everyone within the committee agrees with each other and everyone outside of the committee is glad not to be in it. More precisely:

  • There must not be two people within the committee such that one person dislikes the other.
  • For each person outside the committee there should be someone in the committee who they dislike.

Can you find such a set of people?

입력

The first line contains positive integers NN and MM, the number of people and number of relations between them, respectively.

The ii-th of the following MM lines contains an ordered pair of positive integers a_ia\_i and b_ib\_i (1a_i,b_iN1 ≤ a\_i , b\_i ≤ N), representing the fact that person a_ia\_i dislikes the person b_ib\_i. It holds that a_ib_ia\_i ≠ b\_i for all i=1,2,,Mi = 1, 2, \dots , M and no ordered pair is listed twice.

The given relations will be such that there is no dislike circle consisting of an odd number of people.

출력

If it is not possible to choose a set of people satisfying the given conditions, in the only line print -1.

Otherwise, in the first line print a positive integer KK (1KN1 ≤ K ≤ N), the number of people in the committee. In the next line print KK distinct positive integers p_1,p_2,,p_Kp\_1, p\_2, \dots , p\_K (1p_iN1 ≤ p\_i ≤ N), the indices of the people which make up the committee.

If there is more than one solution, output any one of them.

제한

In all subtasks, it holds that 1N500,0001 ≤ N ≤ 500\\,000 and 0M500,0000 ≤ M ≤ 500\\,000.

힌트

The set of chosen people is shown in the output of each test case.

The first example is a valid test case for the first subtask and for the second subtask.

The second example is not a valid test case for the first subtask, but it is valid for the second subtask.

The third example is not a valid test case for the first subtask nor for the second subtask.