func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f, N = 3.1e5;   int n, m, dis[N], fm[N];   vector<int> vec[N];   void bfs() {     memset(dis, 0x3f, sizeof(dis));     queue<int> q;     q.push(1);     dis[1] = 0;     while (!q.empty()) {       int u = q.front();       q.pop();       for (int v : vec[u])         if (dis[v] == INF) dis[v] = dis[u] + 1, fm[v] = u, q.push(v);     }   }   int x[N], y[N], fa[N], sz[N], d[N];   bool vis[N];   int find(int u) { return u == fa[u] ? u : fa[u] = find(fa[u]); }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m;     for (int i = 1; i <= m; i++)       cin >> x[i] >> y[i], vec[x[i]].push_back(y[i]), vec[y[i]].push_back(x[i]);     bfs();     stack<int> s;     if (dis[n] <= 4)       for (int i = n; i; i = fm[i]) s.push(i);     else {       bool ok = 0;       for (int i = 1; i <= n; i++)         if (dis[i] == 2) {           s.push(n);           s.push(1);           s.push(i);           s.push(fm[i]);           s.push(1);           ok = 1;           break;         }       if (!ok) {         for (int i = 1; i <= n; i++) fa[i] = i, sz[i] = 1;         for (int i = 1; i <= m; i++)           if (x[i] != 1 && y[i] != 1 && dis[x[i]] == 1 && dis[y[i]] == 1) {             int u = x[i], v = y[i];             d[u]++, d[v]++;             int fv = find(v), fu = find(u);             if (fu == fv) continue;             fa[fv] = fu, sz[fu] += sz[fv];           }         for (int i = 1; i <= n; i++)           if (dis[i] == 1 && d[i] != sz[find(i)] - 1) {             for (int v : vec[i])               if (v != 1) vis[v] = 1;             for (int v : vec[i])               if (v != 1) {                 bool Get = 0;                 for (int vv : vec[v])                   if (vv != 1 && vv != i && !vis[vv]) {                     s.push(n);                     s.push(i);                     s.push(vv);                     s.push(v);                     s.push(i);                     s.push(1);                     Get = 1;                     break;                   }                 if (Get) break;               }             break;           }       }     }     cout << int(s.size() - 1) << endl;     while (!s.empty()) cout << s.top() <<    , s.pop();     return 0;   }   