#include<cstdio>
 #include<cstring>
 #include<queue>
 #include<cmath>
 using namespace std;
 const int Ni = 300;
 const int MAX = 1<<26;
 struct Edge{
     int u,v,c;
     int next;
 }edge[4000];
 int n,m;
 int edn;//\u8fb9\u6570
 int p[Ni];//\u7236\u4eb2
 int d[Ni];
 int sp,tp;//\u539f\u70b9\uff0c\u6c47\u70b9

 void addedge(int u,int v,int c)
 {
     edge[edn].u=u; edge[edn].v=v; edge[edn].c=c;
     edge[edn].next=p[u]; p[u]=edn++;

     edge[edn].u=v; edge[edn].v=u; edge[edn].c=0;
     edge[edn].next=p[v]; p[v]=edn++;
 }
 int bfs()
 {
     queue <int> q;
     memset(d,-1,sizeof(d));
     d[sp]=0;
     q.push(sp);
     while(!q.empty())
     {
         int cur=q.front();
         q.pop();
         for(int i=p[cur];i!=-1;i=edge[i].next)
         {
             int u=edge[i].v;
             if(d[u]==-1 && edge[i].c>0)
             {
                 d[u]=d[cur]+1;
                 q.push(u);
             }
         }
     }
     return d[tp] != -1;
 }
 int dfs(int a,int b)
 {
     int r=0;
     if(a==tp)return b;
     for(int i=p[a];i!=-1 && r<b;i=edge[i].next)
     {
         int u=edge[i].v;
         if(edge[i].c>0 && d[u]==d[a]+1)
         {
             int x=min(edge[i].c,b-r);
             x=dfs(u,x);
             r+=x;
             edge[i].c-=x;
             edge[i^1].c+=x;
         }
     }
     if(!r)d[a]=-2;
     return r;
 }

 int dinic(int sp,int tp)
 {
     int total=0,t;
     while(bfs())
     {
         while(t=dfs(sp,MAX))
         total+=t;
     }
     return total;
}
int main(){
	scanf("%d%d",&n,&m);
	edn=0;
	memset(p,-1,sizeof(p));
	for (int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		addedge(a-1,b-1,1);
		addedge(b-1,a-1,1);
	}
	scanf("%d%d",&sp,&tp);
	sp--;
	tp--;
	int ans=dinic(sp,tp),tot=0;
	for (int i=0;i<m;i++) if (edge[i*4+2].c==0) tot++;
	printf("%d\n%d\n",ans,tot);
	for (int i=0;i<m;i++) if (edge[i*4+2].c==0) printf("%d\n",i+1);
	
}