CAPCITY - Capital City


There are N cities in Flatland connected with M unidirectional roads. The cities are numbered from 1 to N. The Flat Circle of Flatland (FCF) wants to set up a new capital city for his kingdom. For security reasons, the capital must be reachable from all other cities of Flatland. FCF needs the list of all candidate cities. You are the chief programmer at FACM (Flat Association for Computing Machinery) responsible for providing the list to FCF as soon as possible.

Input

The first line of the input file contains two integers: 1 ≤ N ≤ 100,000 and 1 ≤ M ≤ 200,000. Each of the following M lines contains two integers 1 ≤ A, B ≤ N denoting a road from A to B.

Output

The output file contains an integer denoting the number of candidate cities followed by the list of candidate cities in increasing order.

Example

Input:
4 4
1 2
3 2
4 3
2 1

Output:
2
1 2

hide comments
karan_batra: 2017-01-06 15:52:51

Weak test cases. No test case when there is no capital city.

hamjosh1: 2016-11-13 10:51:38

Use fast IO costed me TLE

vivekkodu: 2016-09-26 21:39:01

It is accepting solution even in case of disconnected graph.

mvk944: 2016-09-21 20:12:32

guys this can be easily done without graphs...

noob909: 2016-07-04 10:12:49

4 5
1 2
3 2
4 3
2 1
3 4
what will be the output ?

rishabh16196: 2016-06-02 19:53:36

Is there something in testcase 20? I am getting rte.

VISHAL ASHANK: 2016-05-21 10:10:56

nice one...

[Mayank Pratap]: 2016-04-10 11:15:08

Spent a lot of time in this problem... Finally AC :)

minhthai: 2016-03-30 12:36:24

too...many...lines...of...code

GAURAV CHANDEL: 2016-02-23 14:31:41

Lovely Graph Problem..


Added by:Narek Saribekyan
Date:2010-06-20
Time limit:1s-4s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC PERL6 SQLITE VB.NET
Resource:Armenian TST 2010, Round 2