Problem: Friends Alex and Bob live in Bertown. In this town there are n crossroads, some of them are connected by bidirectional roads of equal length. Bob lives in a house at the crossroads number 1, Alex — in a house at the crossroads number n.

One day Alex and Bob had a big quarrel, and they refused to see each other. It occurred that today Bob needs to get from his house to the crossroads n and Alex needs to get from his house to the crossroads 1. And they don't want to meet at any of the crossroads, but they can meet in the middle of the street, when passing it in opposite directions. Alex and Bob asked you, as their mutual friend, to help them with this difficult task.

Find for Alex and Bob such routes with equal number of streets that the guys can follow these routes and never appear at the same crossroads at the same time. They are allowed to meet in the middle of the street when moving toward each other (see Sample 1). Among all possible routes, select such that the number of streets in it is the least possible. Until both guys reach their destinations, none of them can stay without moving. 

The guys are moving simultaneously with equal speeds, i.e. it is possible that when one of them reaches some of the crossroads, the other one leaves it. For example, Alex can move from crossroad 1 to crossroad 2, while Bob moves from crossroad 2 to crossroad 3.

If the required routes don't exist, your program should output -1.

Input

The first line contains two integers n and m (2 ≤ n ≤ 500, 1 ≤ m ≤ 10000) — the amount of crossroads and the amount of roads. Each of the following m lines contains two integers — the numbers of crossroads connected by the road. It is guaranteed that no road connects a crossroads with itself and no two crossroads are connected by more than one road.

Output

If the required routes don't exist, output -1. Otherwise, the first line should contain integer k — the length of shortest routes (the length of the route is the amount of roads in it). The next line should contain k + 1 integers — Bob's route, i.e. the numbers of k + 1 crossroads passed by Bob. The last line should contain Alex's route in the same format. If there are several optimal solutions, output any of them.

Examples

Input

2 1
1 2


Output

1
1 2 
2 1 


Input

7 5
1 2
2 7
7 6
2 3
3 4


Output

-1


Input

7 6
1 2
2 7
7 6
2 3
3 4
1 5


Output

6
1 2 3 4 3 2 7 
7 6 7 2 1 5 1 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 1e18 + 1;
const int MAX = 200001;
const long long MOD = 1000000007;
long long inq(long long k, long long q) {
  if (q == 0) return 1;
  long long l = inq(k, q / 2);
  if (q % 2 == 0)
    return l * l % MOD;
  else
    return (l * l) % MOD * k % MOD;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long cubr(long long a) {
  long long l = -1, r = 1e6 + 2;
  while (l < r - 1) {
    long long mid = (l + r) / 2;
    if (mid * mid * mid > a)
      r = mid;
    else
      l = mid;
  }
  return l;
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) { return -1 * max(-a, -b); }
long long possible(long long q) {
  if (q == INF) return -1;
  return q;
}
bool correct(int x, int xx) {
  if (x < 0) return 0;
  if (x >= xx) return 0;
  return 1;
}
long long dsumm(long long x, long long k) {
  long long y = 1;
  long long z = 0;
  for (int i = 0; y < 1e18; i++) {
    z += x / y % k;
    y *= k;
  }
  return z;
}
long long dcount(long long x) {
  long long y = 1;
  long long z = 0;
  int c[100];
  for (int i = 0; i < 10; i++) c[i] = 0;
  for (int i = 0; x > 0; i++) {
    if (c[x / y % 10] == 0) z++;
    c[x / y % 10] = 1;
    x /= 10;
  }
  return z;
}
long long lg10(long long x) {
  if (x == 0) return 0;
  return lg10(x / 10) + 1;
}
long long n, m;
int a[501][501];
vector<int> graph[501];
int dp[501][501][2];
pair<pair<int, int>, int> prev1234[501][501][2];
int main() {
  memset((dp), -1, sizeof(dp));
  ;
  cin >> n >> m;
  for (int(i) = 0; (i) != (m); i++) {
    int x, y;
    cin >> x >> y;
    a[x][y] = 1;
    a[y][x] = 1;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  dp[1][n][0] = 0;
  vector<pair<pair<int, int>, int>> q;
  q.push_back({{1, n}, 0});
  for (int i = 0; i < q.size(); i++) {
    int x = q[i].first.first;
    int y = q[i].first.second;
    int now = q[i].second;
    if (now == 0) {
      for (int j = 0; j < graph[x].size(); j++) {
        int u = graph[x][j];
        if (dp[u][y][1] == -1) {
          dp[u][y][1] = dp[x][y][0] + 1;
          prev1234[u][y][1] = {{x, y}, 0};
          q.push_back({{u, y}, 1});
        }
      }
    }
    if (now == 1) {
      for (int j = 0; j < graph[y].size(); j++) {
        int u = graph[y][j];
        if (u != x && dp[x][u][0] == -1) {
          dp[x][u][0] = dp[x][y][1] + 1;
          prev1234[x][u][0] = {{x, y}, 1};
          q.push_back({{x, u}, 0});
        }
      }
    }
  }
  if (dp[n][1][0] == -1) {
    cout << -1;
    return 0;
  }
  cout << dp[n][1][0] / 2 << endl;
  pair<pair<int, int>, int> xy = {{n, 1}, 0};
  pair<pair<int, int>, int> ab = {{1, n}, 0};
  vector<int> ans1, ans2;
  while (xy != ab) {
    int x = xy.first.first;
    int y = xy.first.second;
    int now = xy.second;
    if (now == 0) {
      ans1.push_back(x);
    } else {
      ans2.push_back(y);
    }
    xy = prev1234[x][y][now];
  }
  int x = xy.first.first;
  int y = xy.first.second;
  ans1.push_back(x);
  reverse((ans1).begin(), (ans1).end());
  reverse((ans2).begin(), (ans2).end());
  ans2.push_back(1);
  for (int(i) = 0; (i) != (ans1.size()); i++) {
    cout << ans1[i] << " ";
  }
  cout << endl;
  for (int(i) = 0; (i) != (ans2.size()); i++) {
    cout << ans2[i] << " ";
  }
}