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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;

public class Quarrel {

	static class node {
		int x, y, d, t;
		node p;
	}

	static ArrayList<Integer>[] al;
	static int n;

	static boolean bfs() {
		Queue<node> q = new LinkedList<node>();
		node s = new node();
		boolean[][][] v = new boolean[n][n][2];
		v[0][n - 1][0] = true;
		s.x = 0;
		s.y = n - 1;
		s.d = 0;
		s.t = 0;
		s.p = null;
		q.add(s);
		while (!q.isEmpty()) {
			node t = q.poll();
			if (t.x == n - 1 && t.y == 0 && t.t == 0) {
				Stack<Integer> a = new Stack<Integer>();
				Stack<Integer> b = new Stack<Integer>();
				out.println(t.d / 2);
				while (t.p != null) {
					a.add(t.x + 1);
					b.add(t.y + 1);
					t = t.p;
				}
				out.print(1);
				while (!a.isEmpty()) {
					out.print(" " + a.pop());
					a.pop();
				}
				out.println();
				while (!b.isEmpty()) {
					out.print(b.pop() + " ");
					b.pop();
				}
				out.println(1);
				return true;
			}
			if (t.t == 0) {
				for (int i = 0; i < al[t.x].size(); i++) {
					int nx = al[t.x].get(i);
					if (!v[nx][t.y][1]) {
						v[nx][t.y][1] = true;
						s = new node();
						s.x = nx;
						s.y = t.y;
						s.d = t.d + 1;
						s.p = t;
						s.t = 1;
						q.add(s);
					}
				}
			} else {
				for (int i = 0; i < al[t.y].size(); i++) {
					int ny = al[t.y].get(i);
					if (ny != t.x && !v[t.x][ny][0]) {
						v[t.x][ny][0] = true;
						s = new node();
						s.x = t.x;
						s.y = ny;
						s.d = t.d + 1;
						s.p = t;
						s.t = 0;
						q.add(s);
					}
				}
			}
		}
		return false;
	}

	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		sc = new StringTokenizer(br.readLine());
		n = nxtInt();
		int m = nxtInt();
		al = new ArrayList[n];
		for (int i = 0; i < n; i++)
			al[i] = new ArrayList<Integer>();
		while (m-- > 0) {
			int x = nxtInt() - 1;
			int y = nxtInt() - 1;
			al[x].add(y);
			al[y].add(x);
		}
		if (!bfs())
			out.println(-1);
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;
	static PrintWriter out;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}