Company trip

Problem Statement

Your company has n employees. For a group of m employees (a_i, b_i), a_i is the boss of b_i.

When employee x is the actual boss of employee y, it means that at least one of the following holds.


* x is y's boss.
* There is an employee z who is the actual boss of y, and x is the boss of z.



There are no employees in your company who are their actual bosses.

Your company is planning an employee trip with all employees participating. At the request of all employees, the room allocation at the inn must be "good room allocation".
A "good room allocation" means that both of the following are satisfied.


* Each employee is assigned to some room.
* When employee x and employee y are assigned to the same room, x is not the actual boss of y.



Since the secretary's employees are very talented, we allocated the rooms so that they were "good room allocation" and the number of required rooms was minimized. But unfortunately the budget is insufficient. It seems that the number of rooms required must be reduced.
Therefore, you who work in the human resources department decided to reduce the number of rooms required to obtain a "good room allocation" by eliminating only one boss-subordinate relationship.
Now, which relationship should be resolved?

Constraints

* 2 ≤ n ≤ 10 ^ 5
* 1 ≤ m ≤ 2 \ times 10 ^ 5
* 1 ≤ a_i <b_i ≤ n
* If i \ neq j, then (a_i, b_i) \ neq (a_j, b_j)

Input

Input follows the following format. All given numbers are integers.


n m
a_1 b_1
...
a_m b_m

Output

Output i that satisfies the following in ascending order, line by line.

* When the relationship "a_i is the boss of b_i" is resolved, the number of rooms required to obtain "good room allocation" can be reduced.



If such i does not exist, output -1 on one line.

Example

Input

5 4
1 2
2 3
3 4
3 5


Output

1
2
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(__typeof((X).begin()) it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)x.size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<int,int> pi;
typedef stringstream sst;
typedef vector<int> vi;

int n,m;
vector<pi> G[100010];
int dp[100010];
int used[100010];

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>n>>m;
	int a,b;
	rep(i,m){
		cin>>a>>b;
		a--,b--;
		G[b].pb(mp(a,i+1));
	}
	int M=0;
	rep(i,n){
		rep(j,sz(G[i])){
			dp[i]=max(dp[i],dp[G[i][j].fir]+1);
		}
		M=max(M,dp[i]);
	}
	vi v,w,ans;
	rep(i,n)if(dp[i]==M)v.pb(i);
	while(dp[v[0]]){
		//rep(i,sz(v))cout<<v[i]<<" ";cout<<endl;
		w.clear();
		rep(i,sz(v)){
			rep(j,sz(G[v[i]])){
				if(!used[G[v[i]][j].fir] && dp[G[v[i]][j].fir] == dp[v[i]]-1){
					w.pb(G[v[i]][j].fir);
					used[G[v[i]][j].fir]=1;
				}
			}
		}
		if(sz(v)==1 && sz(w)==1){
			rep(i,sz(G[v[0]])){
				if(dp[G[v[0]][i].fir] == dp[v[0]]-1){
					ans.pb(G[v[0]][i].sec);
				}
			}
		}
		v=w;
	}
	sort(ans.begin(),ans.end());
	if(sz(ans)==0)cout<<-1<<endl;
	else rep(i,sz(ans))cout<<ans[i]<<endl;
}