#include <cstring>
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
const int MAX_N = 300;
const int MAX_M = MAX_N * (MAX_N - 1) / 2;

int n, m;
int s, t;
int capacity[MAX_N][MAX_N];
int flow[MAX_N][MAX_N];
vector<int> graph[MAX_N];

bool used[MAX_N];
int dfs(int from, int to, int f) {
	if (from == to) return f;
	used[from] = true;
	for (unsigned i = 0; i < graph[from].size(); i++) {
		const int next = graph[from][i];
		const int cap = capacity[from][next];
		if (!used[next] && cap - flow[from][next] > 0) {
			const int d = dfs(next, t, min(f, cap));
			if (d > 0) {
				flow[from][next] += d;
				flow[next][from] -= d;
				return d;
			}
		}
	}
	return 0;
}

int max_flow() {
	int res = 0;
	while (true) {
		memset(used, 0, sizeof(used));
		int f = dfs(s, t, INT_MAX);
		if (f == 0) return res;
		res += f;
	}
}

int main () {
	vector<pair<int, int> > edges;
	
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		capacity[x][y]++;
		capacity[y][x]++;
		edges.push_back(make_pair(x, y));
		graph[x].push_back(y);
		graph[y].push_back(x);
	}
	cin >> s >> t;
	s--; t--;
	
	cout << max_flow() << endl;
	
	vector<int> ans;
	for (int i = 0; i < m; i++) {
		pair<int, int>& e = edges[i];
		if (flow[e.second][e.first] > 0) {
			ans.push_back(i);
		}
	}
	cout << ans.size() << endl;
	for (unsigned i = 0; i < ans.size(); i++) {
		cout << ans[i] + 1 << endl;
	}
	
	return 0;
}