#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
using namespace std;

int m,n,s,t,fl;
int x[1001],y[1001];
int g[301][301];
int g2[301][301];
int visit[301];
stack<int> rev;

int main(){


  cin >> n >> m;

  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++)g[i][j] = 0;
  }

  for(int i=1;i<=m;i++){
    cin >> x[i] >> y[i];
    g[x[i]][y[i]] = i;
    g2[x[i]][y[i]] = i;
    g2[y[i]][x[i]] = i;
  }

  cin >> s >> t;
  fl = 0;
  while(1){
    /*
    for(int i=1;i<=n;i++){
      for(int j=1;j<=n;j++)cout << g2[i][j] << " ";
      cout << endl;
    }
    */
    for(int i=1;i<=n;i++)visit[i] = 0;
    queue<int> q;
    q.push(s);
    int tmp = 0;
    visit[s] = s;
    while(q.size()){
      tmp = q.front();
      q.pop();
      if(tmp == t)break;
      for(int i=1;i<=n;i++){
	if(g2[tmp][i] && !visit[i]){
	  q.push(i);
	  visit[i] = tmp;
	}
      }
    }
    
    if(tmp == t){
      fl++;
      while(tmp!=s){
	if(!g[visit[tmp]][tmp])rev.push(g2[visit[tmp]][tmp]);
	g2[visit[tmp]][tmp] = 0;
	g2[tmp][visit[tmp]] = 0;
	tmp = visit[tmp];
      }
    }else break;
  }

  cout << fl << endl;
  cout << (int)rev.size() << endl;
  while(rev.size()){
    cout << rev.top() << endl;
    rev.pop();
  }
}