// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
struct edge{int to,cap,rev,id;};//ikisaki youryou gyakuhen
class MF{//max flow
	public:
	int n;
	vector<vector<edge> >G;//[MAX];
	vector<bool>used;//[MAX];
	MF(int size){
		n=size;
		G=vector<vector<edge> >(n);
	}
	void add_edge(int from, int to, int cap,int id){
		edge q={to,cap,int(G[to].size()),id};
		G[from].push_back(q);
		q={from,cap,int(G[from].size()-1),-id};
		G[to].push_back(q);
	}
	int dfs(int v,int t, int f) {
		if(v==t)return f;
		used[v]=1;
		for(int i=0;i<G[v].size();i++){
			edge &e=G[v][i];
			if(used[e.to]||e.cap<=0) continue;
			int d =dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				G[e.to][e.rev].cap+=d;
				return d;
			}
		}
		return 0;
	}
	int mf(int s,int t) {//from s to t,ford_fulkerson
		int flow=0,f;
		while(1){
			used=vector<bool>(n,false);
			f=dfs(s,t,inf);
			if(f==0)return flow;
			flow+=f;
		}
	}
};
int main(){
	int n,m;
	cin>>n>>m;
	MF mf(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--;b--;
		mf.add_edge(a,b,1,i+1);
	}
	int s,t;
	cin>>s>>t;
	s--;t--;
	int flow=mf.mf(s,t);
	vi out;
	rep(i,n)rep(j,mf.G[i].size()){
		edge e=mf.G[i][j];
		if(e.id<0&&e.cap==0)out.pb(-e.id);
	}
	
	cout<<flow<<endl;
	cout<<out.size()<<endl;
	rep(i,out.size())cout<<out[i]<<endl;
}

/*
int n;
vvi in;
map<pii,int>ma;
bool dfs(int a){
	rep(i,n+1){
		if(i==n)return true;
		if(in[i][3]==0){
			
		}
	}
}
int main(){
	while(cin>>n,n){
		in=vvi(n,vi(4));
		ma.clear();
		rep(i,n){
			int a,b;
			char c;
			cin>>a>>b>>c;
			in[i]={a,b,c=='y',0};
			ma[{a,b}]=i+1;
			if(c=='x')a++;
			else b++;
			ma[{a,b}]=i+1;
		}
		if(dfs(0))cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}
*/








Measured memory_bytes: 3240