Indiana Jones found ancient Aztec catacombs containing a golden idol. The catacombs consists of n caves. Each pair of caves is connected with a two-way corridor that can be opened or closed. The entrance to the catacombs is in the cave 1, the idol and the exit are in the cave n.

When Indiana goes from a cave x to a cave y using an open corridor, all corridors connected to the cave x change their state: all open corridors become closed, all closed corridors become open. Indiana wants to go from cave 1 to cave n going through as small number of corridors as possible. Help him find the optimal path, or determine that it is impossible to get out of catacombs.

Input

The first line contains two integers n and m (2 ≤ n ≤ 3⋅ 10^5, 0 ≤ m ≤ 3 ⋅ 10^5) — the number of caves and the number of open corridors at the initial moment.

The next m lines describe the open corridors. The i-th of these lines contains two integers u_i and v_i (1 ≤ u_i, v_i ≤ n, u_i ≠ v_i) — the caves connected by the i-th open corridor. It is guaranteed that each unordered pair of caves is presented at most once.

Output

If there is a path to exit, in the first line print a single integer k — the minimum number of corridors Indians should pass through (1 ≤ k ≤ 10^6). In the second line print k+1 integers x_0, …, x_k — the number of caves in the order Indiana should visit them. The sequence x_0, …, x_k should satisfy the following:

  * x_0 = 1, x_k = n;
  * for each i from 1 to k the corridor from x_{i - 1} to x_i should be open at the moment Indiana walks along this corridor.



If there is no path, print a single integer -1.

We can show that if there is a path, there is a path consisting of no more than 10^6 corridors.

Examples

Input

4 4
1 2
2 3
1 3
3 4


Output

2
1 3 4 


Input

4 2
1 2
2 3


Output

4
1 2 3 1 4 
#include <bits/stdc++.h>
using namespace std;
int const M = 3e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10;
int a[M], n, q[M], p[M], d[M];
bool vis[M];
bool mark[M];
vector<int> hlp;
vector<int> ans, adj[M];
int mn = inf, now = 0;
void dfs(int v) {
  now++;
  mark[v] = 1;
  hlp.push_back(v);
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (!mark[u]) dfs(u);
  }
}
int pw(int x, int y) {
  if (y == 0) return 1;
  int tmp = pw(x, y / 2);
  if (y % 2 == 0) return (tmp * tmp) % mod;
  return (((tmp * tmp) % mod) * x) % mod;
}
int sa(int x, int y) {
  if (x % y == 0) return x / y;
  return x / y + 1;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if (a == 1 && b == n) {
      cout << 1 << endl;
      cout << 1 << " " << n;
      return 0;
    }
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  int head = 0, tail = 0;
  q[head++] = 1;
  d[1] = 1;
  int cnt = 0;
  while (head > tail) {
    cnt++;
    int v = q[tail++];
    if (v == n) {
      mn = min(mn, d[v] - 1);
      int tmp = v;
      ans.push_back(tmp);
      while (p[tmp] != 0) {
        ans.push_back(p[tmp]);
        tmp = p[tmp];
      }
      reverse(ans.begin(), ans.end());
    }
    for (int i = 0; i < adj[v].size(); i++) {
      int u = adj[v][i];
      if (!d[u]) q[head++] = u, d[u] = d[v] + 1, p[u] = v;
    }
  }
  if (adj[1].size() != cnt - 1 && mn > 4) {
    ans.clear();
    mn = 4;
    mark[1] = 1;
    for (int j = 0; j < adj[1].size(); j++) {
      int u = adj[1][j];
      mark[u] = 1;
    }
    bool flag = 0;
    for (int j = 0; j < adj[1].size(); j++) {
      if (flag) break;
      int u = adj[1][j];
      for (int k = 0; k < adj[u].size(); k++) {
        int uu = adj[u][k];
        if (!mark[uu] && ans.size() == 0) {
          ans.push_back(1);
          ans.push_back(u);
          ans.push_back(uu);
          ans.push_back(1);
          ans.push_back(n);
          flag = 1;
          break;
        }
      }
    }
  } else if (mn > 5 && adj[1].size() == cnt - 1) {
    int good = 0;
    mark[1] = 1;
    bool flag = 0;
    for (int i = 0; i < adj[1].size(); i++) {
      now = 0;
      if (flag) break;
      hlp.clear();
      int u = adj[1][i];
      if (!mark[u])
        dfs(u);
      else
        continue;
      for (int j = 0; j < hlp.size(); j++) {
        int uu = hlp[j];
        if (adj[uu].size() != now) good = uu;
      }
      if (good == 0) continue;
      for (int k = 0; k < adj[good].size(); k++) vis[adj[good][k]] = 1;
      vis[good] = 1;
      for (int k = 0; k < adj[good].size(); k++) {
        int vv = adj[good][k];
        if (vv == 1) continue;
        for (int l = 0; l < adj[vv].size(); l++) {
          int nn = adj[vv][l];
          if (!vis[nn] && nn != 1) {
            flag = 1;
            mn = 5;
            ans.push_back(1);
            ans.push_back(good);
            ans.push_back(vv);
            ans.push_back(nn);
            ans.push_back(good);
            ans.push_back(n);
            break;
          }
        }
        if (flag) break;
      }
    }
  }
  if (mn == inf) return cout << -1, 0;
  cout << mn << endl;
  for (int j = 0; j < ans.size(); j++) cout << ans[j] << " ";
}
