#include <bits/stdc++.h>
using namespace std;
const int nmax = 20010;
int n, m;
vector < pair <int, int> > g[nmax];
bool used[nmax];
int tin[nmax], up[nmax], timer = 0;
map < pair<int,int>, vector<int> > ans;
void dfs(int v, int p = -1)
{
used[v] = 1;
tin[v] = up[v] = ++timer;
for (int i = 0; i < (int)g[v].size(); ++i)
{
int to = g[v][i].first, id = g[v][i].second;
if (to == p)
continue;
if (used[to])
up[v] = min(up[v], tin[to]);
else
{
dfs(to, v);
up[v] = min(up[v], up[to]);
if (up[to] > tin[v])
{
bool ch = 0;
if (v > to)
swap(v, to), ch = 1;
ans[make_pair(v, to)].push_back(id);
if (ch)
swap(v, to);
}
}
}
}
int main()
{
cin >> n >> m;
for (int i = 0; i < m; ++i)
{
int v, u;
cin >> v >> u;
g[v].push_back(make_pair(u, i));
g[u].push_back(make_pair(v, i));
}
for (int i = 1; i <= n; ++i)
if (!used[i])
dfs(i);
set<int> br;
for (auto i : ans)
if (i.second.size() == 1)
br.insert(*i.second.begin() + 1);
cout << (int)br.size() << "\n";
for (auto i : br)
cout << i << "\n";
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IG5tYXggPSAyMDAxMDsKCmludCBuLCBtOwp2ZWN0b3IgPCBwYWlyIDxpbnQsIGludD4gPiBnW25tYXhdOwpib29sIHVzZWRbbm1heF07CmludCB0aW5bbm1heF0sIHVwW25tYXhdLCB0aW1lciA9IDA7Cm1hcCA8IHBhaXI8aW50LGludD4sIHZlY3RvcjxpbnQ+ID4gYW5zOwoKdm9pZCBkZnMoaW50IHYsIGludCBwID0gLTEpCnsKICAgIHVzZWRbdl0gPSAxOwogICAgdGluW3ZdID0gdXBbdl0gPSArK3RpbWVyOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCAoaW50KWdbdl0uc2l6ZSgpOyArK2kpCiAgICB7CiAgICAgICAgaW50IHRvID0gZ1t2XVtpXS5maXJzdCwgaWQgPSBnW3ZdW2ldLnNlY29uZDsKICAgICAgICBpZiAodG8gPT0gcCkKICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgaWYgKHVzZWRbdG9dKQogICAgICAgICAgICB1cFt2XSA9IG1pbih1cFt2XSwgdGluW3RvXSk7CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgZGZzKHRvLCB2KTsKICAgICAgICAgICAgdXBbdl0gPSBtaW4odXBbdl0sIHVwW3RvXSk7CiAgICAgICAgICAgIGlmICh1cFt0b10gPiB0aW5bdl0pCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGJvb2wgY2ggPSAwOwogICAgICAgICAgICAgICAgaWYgKHYgPiB0bykKICAgICAgICAgICAgICAgICAgICBzd2FwKHYsIHRvKSwgY2ggPSAxOwogICAgICAgICAgICAgICAgYW5zW21ha2VfcGFpcih2LCB0byldLnB1c2hfYmFjayhpZCk7CiAgICAgICAgICAgICAgICBpZiAoY2gpCiAgICAgICAgICAgICAgICAgICAgc3dhcCh2LCB0byk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0KCmludCBtYWluKCkKewogICAgY2luID4+IG4gPj4gbTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbTsgKytpKQogICAgewogICAgICAgIGludCB2LCB1OwogICAgICAgIGNpbiA+PiB2ID4+IHU7CiAgICAgICAgZ1t2XS5wdXNoX2JhY2sobWFrZV9wYWlyKHUsIGkpKTsKICAgICAgICBnW3VdLnB1c2hfYmFjayhtYWtlX3BhaXIodiwgaSkpOwogICAgfQogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKQogICAgICAgIGlmICghdXNlZFtpXSkKICAgICAgICAgICAgZGZzKGkpOwogICAgc2V0PGludD4gYnI7CiAgICBmb3IgKGF1dG8gaSA6IGFucykKICAgICAgICBpZiAoaS5zZWNvbmQuc2l6ZSgpID09IDEpCiAgICAgICAgICAgIGJyLmluc2VydCgqaS5zZWNvbmQuYmVnaW4oKSArIDEpOwogICAgY291dCA8PCAoaW50KWJyLnNpemUoKSA8PCAiXG4iOwogICAgZm9yIChhdXRvIGkgOiBicikKICAgICAgICBjb3V0IDw8IGkgPDwgIlxuIjsKCiAgICByZXR1cm4gMDsKfQ==