#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))


typedef int Weight;
struct Edge {
  int src;
  int dest;
  Weight weight;
  Edge(int src, int dest, Weight weight) : src(src), dest(dest), weight(weight) {;}
  bool operator<(const Edge &rhs) const {
    if (weight != rhs.weight) { return weight > rhs.weight; }
    if (src != rhs.src) { return src < rhs.src; }
    return dest < rhs.dest;
  }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;

void PrintMatrix(const Matrix &matrix) {
  for (int y = 0; y < (int)matrix.size(); y++) {
    for (int x = 0; x < (int)matrix[y].size(); x++) {
      printf("%d ", matrix[y][x]);
    }
    puts("");
  }
}


int MaxFlow(const Graph &g, int s, int t, Matrix &flow) {
  const int n = g.size();
  Matrix capacity(n, Array(n, 0));
  flow = Matrix(n, Array(n, 0));
  for (int i = 0; i < n; i++) {
    for (Edges::const_iterator it = g[i].begin(); it != g[i].end(); it++) {
      capacity[it->src][it->dest] = it->weight;
    }
  }
  int ret = 0;
  vector<int> parent(n);
  while (true) {
    fill(parent.begin(), parent.end(), -1);
    queue<Edge> que;
    que.push(Edge(s, s, 0));
    while (!que.empty()) {
      Edge node = que.front();
      que.pop();
      if (parent[node.dest] != -1) { continue; }
      parent[node.dest] = node.src;
      if (node.dest == t) { break; }
      int from = node.dest;
      for (Edges::const_iterator it = g[from].begin(); it != g[from].end(); it++) {
        int to = it->dest;
        if (capacity[from][to] == 0 || parent[to] != -1) { continue; }
        que.push(Edge(from, to, 0));
      }
    }
    if (parent[t] == -1) { break; }
    Weight f = 2000000000;
    int from = parent[t];
    int to = t;
    while (from != to) {
      f = min(f, capacity[from][to]);
      from = parent[from];
      to = parent[to];
    }
    from = parent[t];
    to = t;
    while (from != to) {
      capacity[from][to] -= f;
      capacity[to][from] += f;
      flow[from][to] += f;
      flow[to][from] -= f;
      from = parent[from];
      to = parent[to];
    }
    ret += f;
  }
  return ret;
}

void AddEdge(Graph &g, int from, int to, Weight capacity) {
  g[from].push_back(Edge(from, to, capacity));
  g[to].push_back(Edge(to, from, capacity));
}

int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) > 0) {
    Graph g(n);
    vector<Edge> edges;
    REP(i, m) {
      int f, t;
      scanf("%d %d", &f, &t);
      f--; t--;
      AddEdge(g, t, f, 1);
      edges.push_back(Edge(f, t, 1));
    }
    int s, t;
    scanf("%d %d", &s, &t);
    s--; t--;
    Matrix flow;
    int f = MaxFlow(g, s, t, flow);
    vector<int> ans;
    REP(i, m) {
      if (flow[edges[i].dest][edges[i].src] == 1) { ans.push_back(i + 1); }
    }
    printf("%d\n%d\n", f, (int)ans.size());
    FORIT(it, ans) {
      printf("%d\n", *it);
    }
  }
}