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.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public int n,m;
	public ArrayList<Integer> s[];
	
	public void run () throws Exception {
		Scanner in = new Scanner(System.in);
		//Scanner in = new Scanner(new File("input.txt"));
		PrintWriter pw = new PrintWriter(System.out);

		n=in.nextInt();
		m=in.nextInt();
		s = new ArrayList[n];
		for(int i=0;i<n;i++)
			s[i] = new ArrayList<Integer>();
		
		for(int i=0;i<m;i++){
			int x = in.nextInt();
			int y = in.nextInt();
			x--;y--;
			s[x].add(y);
			s[y].add(x);
		}
		boolean[][][] u = new boolean[n][n][2];
		int[][][] f = new int[n][n][2];
		int q[] = new int[n*n*2];
		int head=0,tail=1;
		q[0] = 2*n-2;
		u[0][n-1][0]=true;
		while(head < tail){
			int curr = q[head];head++;
			int a = curr/2 / n;
			int b = (curr/2) % n;
			int c = curr % 2;
			int d = (c==1 ? b : a);
			for(int i=0;i<s[d].size();i++){
				int v1 = (c==0? s[d].get(i) : a);
				int v2 = (c==1? s[d].get(i) : b);
				if((c==0 || v1!=v2) && !u[v1][v2][1-c]){
					u[v1][v2][1-c]=true;
					f[v1][v2][1-c]=curr;
					q[tail]=(v1*n+v2)*2+1-c;
					tail++;
				}
			}
			if(u[n-1][0][0]) break;
		}
		if(u[n-1][0][0]){
			ArrayList<Integer> r1 = new ArrayList<Integer>();
			ArrayList<Integer> r2 = new ArrayList<Integer>();
			
			int a = n-1;
			int b = 0;
			int c = 0;
			while(a!=0 || b!=n-1 || c!=0){
				if(c==0) r2.add(b);
				else r1.add(a);
				int t = f[a][b][c];
				a = t / 2 / n;
				b = (t/2) % n;
				c = t % 2;
			}
			r1.add(a);
			r2.add(b);
			
			Collections.reverse(r1);			
			Collections.reverse(r2);
			pw.println(r1.size()-1);
			for(int i=0;i<r1.size();i++){
				if(i>0) pw.print(" ");
				pw.print(r1.get(i)+1);
			}
			pw.println();
			for(int i=0;i<r2.size();i++){
				if(i>0) pw.print(" ");
				pw.print(r2.get(i)+1);
			}
			pw.println();
			
		}else pw.println("-1");

		in.close();
		pw.close();
	}
	public static void main(String[] args) throws Exception {
		new Main ().run();
	}

}