/*
 * Author:  Teletubbies
 * Created Time:  2012年08月29日 星期三 12&#26102;39分28秒
 * File Name: e.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <time.h>
#include <cctype>
#include <functional>
#include <deque>
#include <iomanip>
#include <bitset>
#include <assert.h>
#include <numeric>
#include <sstream>
#include <utility>

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORD(i,a,b) for (int i=(a); i>=(b); i--)
#define REP(i,b) FOR(i,0,b)
#define sf scanf
#define pf printf
using namespace std;
const int maxint = -1u>>1;
const double pi = 3.14159265358979323;
const double eps = 1e-8;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<int>::iterator vit;
#define maxn 310
#define maxm 500000
int eh[maxn], tot, cur[maxn];
const int inf = 1 << 30;
int dist[maxn];
int s, t;
int n, m;

struct Edge {
    int u, v, cap, flow, next;
}et[maxm];

void init() {
    tot = 0;
    memset(eh, -1, sizeof(eh));
}

void add(int u, int v, int cap, int flow) {
    Edge e = {u, v, cap, flow, eh[u]};
    et[tot] = e;
    eh[u] = tot++;
}

void addedge(int u, int v, int cap) {
    add(u, v, cap, 0), add(v, u, cap, 0);
}
    
bool bfs() {
    int que[maxn];
    int head = 0, tail = 0;
    memset(dist, -1, sizeof(dist));
    dist[t] = 0;
    que[tail++] = t;
    while(head < tail && dist[s] == -1) {
        int u = que[head++];
        for(int i = eh[u]; i != -1; i = et[i].next) {
            int v = et[i].v;
            if(et[i^1].cap > et[i^1].flow && dist[v] == -1) {
                dist[v] = dist[u] + 1;
                que[tail++] = v;
            }
        }
    }
    return dist[s] != -1;
}

int dfs(int u, int d) {
    if(u == t) return d;
    int l = d;
    //cout << u << "********" <<  endl;
    for(int &i = cur[u]; i != -1; i = et[i].next) {
        int v = et[i].v;
        if(et[i].cap > et[i].flow && dist[u] == dist[v] + 1) {
            //cout << v << " " << d << endl;
            int tmp = dfs(v, min(l, et[i].cap - et[i].flow));
            //cout << v << "tmp = " << tmp << endl;
            et[i].flow += tmp;
            et[i^1].flow -= tmp;
            l -= tmp;
            if(l == 0) break;
        }
    }
    //cout << d -  l << "asdfads" << endl;
    return d - l;
}

int Dinic() {
    int flow = 0;
    while(bfs()) {
        //cout << "dist" << endl;
        //for(int i = 1; i <= n; i++) {
            //cout << dist[i] << endl;
        //}
        for(int i = 1; i <= n; i++) cur[i] = eh[i];
        flow += dfs(s, inf);
    }
    return flow;
}

int main() 
{
    //freopen("in1.txt", "r", stdin);
    //freopen("E.out3", "w", stdout);
    
    while(~scanf("%d%d", &n, &m)) {
        init();
        int u, v;
        for(int i = 0; i < m; i++) {
            scanf("%d%d", &u, &v);
            addedge(u, v, 1);
            //cout << u << " " << v << endl;
        }
        scanf("%d%d", &s, &t);
        int ans = Dinic();
        printf("%d\n", ans);
        vector<int> vec;
        vec.clear();
        //cout << tot << endl;
        for(int i = 0; i < tot; i += 2) {
            //cout << et[i].u << " " << et[i].v << " " << et[i].flow << endl;
            if(et[i].flow < 0) {
                vec.pb(i / 2 + 1);
            }
        }
        printf("%d\n", vec.size());
        for(int i = 0; i < vec.size(); i++) {
            printf("%d\n", vec[i]);
        }
        break;
    }
    
    //while(1);
    return 0;
}

Measured memory_bytes: 1264