import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;

public class Solution
{
    static class InputReader
    {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream st)
        {
          this.stream = st;
        }

        public int read()
        {
          if (snumChars == -1)
            throw new InputMismatchException();
          if (curChar >= snumChars)
          {
            curChar = 0;
            try
            {
              snumChars = stream.read(buf);
            } catch (IOException e)
            {
              throw new InputMismatchException();
            }
            if (snumChars <= 0)
              return -1;
          }
          return buf[curChar++];
        }

        public int nextInt()
        {
          int c = read();
          while (isSpaceChar(c))
          {
            c = read();
          }
          int sgn = 1;
          if (c == '-')
          {
            sgn = -1;
            c = read();
          }
          int res = 0;
          do
          {
            res *= 10;
            res += c - '0';
            c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
        }

        public long nextLong()
        {
          int c = read();
          while (isSpaceChar(c))
          {
            c = read();
          }
          int sgn = 1;
          if (c == '-')
          {
            sgn = -1;
            c = read();
          }
          long res = 0;
          do
          {
            res *= 10;
            res += c - '0';
            c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
        }

        public int[] nextIntArray(int n)
        {
          int a[] = new int[n];
          for (int i = 0; i < n; i++)
          {
            a[i] = nextInt();
          }
          return a;
        }

        public String readString()
        {
          int c = read();
          while (isSpaceChar(c))
          {
            c = read();
          }
          StringBuilder res = new StringBuilder();
          do
          {
            res.appendCodePoint(c);
            c = read();
          } while (!isSpaceChar(c));
          return res.toString();
        }

        public String nextLine()
        {
          int c = read();
          while (isSpaceChar(c))
            c = read();
          StringBuilder res = new StringBuilder();
          do
          {
            res.appendCodePoint(c);
            c = read();
          } while (!isEndOfLine(c));
          return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c)
        {
          return c == '\n' || c == '\r' || c == -1;
        }
    }

    public static void main(String[] args)throws Exception
    {
        InputReader in=new InputReader(System.in);
        PrintWriter w=new PrintWriter(System.out);
        int n=in.nextInt();
        int x=in.nextInt();
        int[] ar=new int[n];
        ar=in.nextIntArray(n);
        int[] fr=new int[100001];
        for(int i=0;i<n;i++)
        {
            fr[ar[i]]++;
        }
        boolean pos=false;
        //Arrays.sort(ar);
        for(int i=0;i<n;i++)
        {
            if(fr[i]==2)
            {
                pos=true;
                break;
            }
        }
        if(!pos)
        {
            int count=0;
            for(int i=n-1;i>=0;i--)
            {
                if((fr[ar[i]&x]>=1) && (ar[i]&x)!=ar[i])
                {
                    count++;
                    pos=true;
                    break;
                }
                else
                {
                    fr[ar[i]]--;
                    ar[i]=ar[i]&x;
                    fr[ar[i]]++;
                    count++;
                }
            }
            if(pos)
            {
                w.println(count);
            }
            else
            {
                w.println("-1");
            }
        }
        else
        {
            w.println("0");
        }
        w.close();
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;

public class Solution
{
    static class InputReader
    {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;

        public InputReader(InputStream st)
        {
          this.stream = st;
        }

        public int read()
        {
          if (snumChars == -1)
            throw new InputMismatchException();
          if (curChar >= snumChars)
          {
            curChar = 0;
            try
            {
              snumChars = stream.read(buf);
            } catch (IOException e)
            {
              throw new InputMismatchException();
            }
            if (snumChars <= 0)
              return -1;
          }
          return buf[curChar++];
        }

        public int nextInt()
        {
          int c = read();
          while (isSpaceChar(c))
          {
            c = read();
          }
          int sgn = 1;
          if (c == '-')
          {
            sgn = -1;
            c = read();
          }
          int res = 0;
          do
          {
            res *= 10;
            res += c - '0';
            c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
        }

        public long nextLong()
        {
          int c = read();
          while (isSpaceChar(c))
          {
            c = read();
          }
          int sgn = 1;
          if (c == '-')
          {
            sgn = -1;
            c = read();
          }
          long res = 0;
          do
          {
            res *= 10;
            res += c - '0';
            c = read();
          } while (!isSpaceChar(c));
          return res * sgn;
        }

        public int[] nextIntArray(int n)
        {
          int a[] = new int[n];
          for (int i = 0; i < n; i++)
          {
            a[i] = nextInt();
          }
          return a;
        }

        public String readString()
        {
          int c = read();
          while (isSpaceChar(c))
          {
            c = read();
          }
          StringBuilder res = new StringBuilder();
          do
          {
            res.appendCodePoint(c);
            c = read();
          } while (!isSpaceChar(c));
          return res.toString();
        }

        public String nextLine()
        {
          int c = read();
          while (isSpaceChar(c))
            c = read();
          StringBuilder res = new StringBuilder();
          do
          {
            res.appendCodePoint(c);
            c = read();
          } while (!isEndOfLine(c));
          return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c)
        {
          return c == '\n' || c == '\r' || c == -1;
        }
    }

    public static void main(String[] args)throws Exception
    {
        InputReader in=new InputReader(System.in);
        PrintWriter w=new PrintWriter(System.out);
        int n=in.nextInt();
        int x=in.nextInt();
        int[] ar=new int[n];
        ar=in.nextIntArray(n);
        int[] fr=new int[100001];
        for(int i=0;i<n;i++)
        {
            fr[ar[i]]++;
        }
        boolean pos=false;
        //Arrays.sort(ar);
        for(int i=0;i<n;i++)
        {
            if(fr[i]==2)
            {
                pos=true;
                break;
            }
        }
        if(!pos)
        {
            for(int i=n-1;i>=0;i--)
            {
                if((fr[ar[i]&x]>=1) && ((ar[i]&x)!=ar[i]))
                {
                    pos=true;
                    break;
                }
            }
            if(pos)
            {
                w.println("1");
            }
            else
            {
                w.println("-1");
            }
        }
        else
        {
            w.println("0");
        }
        w.close();
    }
}


import java.util.*;

public class ques2 {

    public static  void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=0,x=0;
        if(scan.hasNext())
            n=scan.nextInt();
        if(scan.hasNext())
            x=scan.nextInt();
        int[] arr=new int[n];
        HashSet<Integer> set=new HashSet<>();
        for(int i=0;i<n;i++){
            if(scan.hasNext())
                arr[i]=scan.nextInt();
            set.add(arr[i]);
        }
        if(set.size()<n){
            System.out.println(0);
            return;
        }else{
            for(int j=0;j<n;j++){
                set.remove(arr[j]);
                if(set.contains(arr[j] & x)){
                    System.out.println(1);
                    return;
                }
                set.add(arr[j]);
            }
        }
        System.out.println(-1);
    }
}


import java.util.*;

public class ques2 {

    public static  void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=0,x=0,k=0,c=0;
        if(scan.hasNext())
            n=scan.nextInt();
        if(scan.hasNext())
            x=scan.nextInt();
        Set<Integer> set=new HashSet<>(),set2=new HashSet<>();
        for (int i=0;i<n;i++){
            if(scan.hasNext())
                k=scan.nextInt();
            set.add(k);
            if((k&x)!=k)
            set2.add(k&x);
            else
                c++;
        }
        if(set.size()!=n){
            System.out.println(0);
            return;
        }else{
            Iterator<Integer> it=set.iterator();
            while(it.hasNext()){
                if(set2.contains(it.next())){
                    System.out.println(1);
                    return;
                }
            }
            if(set2.size()!=n-c) {
                System.out.println(2);
                return;
            }
        }
        System.out.println(-1);

    }
}


import java.util.*;

public class ques2 {

    public static  void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        int n=0,x=0;
        if(scan.hasNext())
            n=scan.nextInt();
        if(scan.hasNext())
            x=scan.nextInt();
        int[] arr=new int[n];
        HashSet<Integer> set=new HashSet<>(),set2=new HashSet<>();
        for(int i=0;i<n;i++){
            if(scan.hasNext())
                arr[i]=scan.nextInt();
            set.add(arr[i]);
            set2.add(arr[i]&x);
        }
        if(set.size()<n){
            System.out.println(0);
            return;
        }else if(set2.size()<n) {
            System.out.println(2);
            return;
        }else{
            for(int j=0;j<n;j++){
                set.remove(arr[j]);
                if(set.contains(arr[j] & x)){
                    System.out.println(1);
                    return;
                }
                set.add(arr[j]);
            }
        }
        System.out.println(-1);
    }
}


    import java.util.*;

    public class and{
        public static void main(String[] args){
            Scanner s = new Scanner(System.in);
            int n= s.nextInt();
            int x= s.nextInt();
            int a[] = new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]= s.nextInt();
            }
            int c=-1;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<n;j++)
                {
                    if(i!=j)
                    {
                        if(a[i]==a[j])
                        {
                            c=0;
                            break;
                        }
                        else if((a[j]&x)==a[i])
                        {   c=1;

                        }
                        else if((a[j]&x)==(a[i]&x)&&c!=1)
                        {c=2;

                        }

                    }

                }
                if(c==0)break;
            }
            System.out.println(c);

        }

    }


    import java.util.*;

    public class and{
        public static void main(String[] args){
            Scanner s = new Scanner(System.in);
            int n= s.nextInt();
            int x= s.nextInt();
            int a[] = new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]= s.nextInt();
            }
            int c=-1;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<n;j++)
                {
                    if(i!=j)
                    {
                        if(a[i]==a[j])
                        {
                            c=0;
                            break;
                        }
                        else if((a[j]&x)==a[i])
                        {   c=1;

                        }
                        else if((a[j]&x)==(a[i]&x)&&c!=1)
                        {c=2;

                        }

                    }
                    if(c==0)break;
                }
            }
            System.out.println(c);

        }
    }


    import java.util.*;

    public class and{
        public static void main(String[] args){
            Scanner s = new Scanner(System.in);
            int n= s.nextInt();
            int x= s.nextInt();
            int a[] = new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]= s.nextInt();
            }
            int c=-1;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<n;j++)
                {
                    if(i!=j)
                    {
                        if(a[i]==a[j])
                        {
                            c=0;
                            break;
                        }
                        else if((a[j]&x)==a[i])
                        {   c=1;

                        }
                        else ((a[j]&x)==(a[i]&x))
                        {c=2;

                        }

                    }
                    if(c==0)break;
                }
            }
            System.out.println(c);

        }
    }


    import java.util.*;

    public class and{
        public static void main(String[] args){
            Scanner s = new Scanner(System.in);
            int n= s.nextInt();
            int x= s.nextInt();
            int a[] = new int[n];
            for(int i=0;i<n;i++)
            {
                a[i]= s.nextInt();
            }
            int c=-1;
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<n;j++)
                {
                    if(i!=j)
                    {
                        if(a[i]==a[j])
                        {
                            c=0;
                            break;
                        }
                        else if((a[j]&x)==a[i])
                        {   c=1;

                        }
                        else if((a[j]&x)==(a[i]&x))
                        {c=2;

                        }

                    }
                    if(c==0)break;
                }
            }
            System.out.println(c);

        }
    }


        import java.util.*;

        public class and{
            public static void main(String[] args){
                Scanner in = new Scanner(System.in);
             int n = in.nextInt();
            int x = in.nextInt();
            int[] arr = new int[n];
            int[] freq = new int[100000+1];
            boolean[] and = new boolean[100000+1];
            for (int i = 0; i <n ; i++) {
                arr[i]=in.nextInt();
                freq[arr[i]]++;
            }
            int min = 0;
            boolean ok = false;
            for (int i = 0; i <arr.length ; i++){
                if (freq[arr[i]] > 1){
                    ok = true;
                    break;
                }
            }
            if (ok){
                System.out.println(min);
                return;
            }
            min=1;
            for (int i = 0; i <n; i++){
                freq[arr[i]]--;
                int v = (arr[i]&x);
                freq[v]++;
                if (freq[v] > 1){
                    ok=true;
                    break;
                }
                freq[arr[i]]++;
                freq[v]--;
            }
            if (ok){
                System.out.println(min);
                return;
            }
            min = 2;
            for (int i = 0; i <arr.length ; i++) {
                freq[arr[i]]--;
                freq[(arr[i]&x)]++;
                if (freq[(arr[i]&x)] > 1){
                    ok = true;
                    break;
                }
            }
            if (ok){
                System.out.println(min);
                return;
            }
            System.out.println(-1);
            }

        }


import java.util.*;

public class and{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n= s.nextInt();
        int x= s.nextInt();
        int a[] = new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]= s.nextInt();
        }
        int c=-1;
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<n;j++)
            {
                if(i!=j)
                {
                    if(a[i]==a[j])
                    {
                        c=0;
                        break;
                    }
                    else if((a[j]&x)==a[i])
                    {   c=1;
                        break;
                    }
                    else if((a[j]&x)==(a[i]&x))
                    {c=2;
                        break;
                    }

                }
                if(c!=-1)break;
            }
        }
        System.out.println(c);

    }
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @author Avto
 * @email avto.bolashvili@maxinai.com
 */
public class Problem {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int x = scanner.nextInt();

        Set<Integer> set = new HashSet<>();
        int more = 0;
        int eq = 0;
        int ans = -1;

        for (int i = 0; i < n; i++) {
            int current = scanner.nextInt();
            if (set.contains(current)) {
                ans = 0;
            } else {
                set.add(current);
            }
            if (current > x) {
                more++;
            }
            else if (current == x) {
                eq++;
            }
        }

        if (ans > -1) {
            System.out.println(ans);
            return;
        }
        if(more == 0) {
            System.out.println(-1);
            return;
        }
        if (eq == 1) {
            System.out.println(1);
        } else {
            if (more == 1) {
                System.out.println(-1);
            } else {
                System.out.println(2);
            }
        }
    }
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @author Avto
 * @email avto.bolashvili@maxinai.com
 */
public class Problem {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int x = scanner.nextInt();
        int[] arr = new int[n];
        boolean isDist = true;

        Set<Integer> was = new HashSet<>();
        Set<Integer> dist = new HashSet<>();

        for (int i = 0; i < n; i++) {
            int current = scanner.nextInt();
            arr[i] = current;

            if (was.contains(current)) {
                System.out.println(0);
                return;
            }

            if (dist.contains(current & x)) {
                isDist = false;
            }
            dist.add(current & x);

            was.add(current);
        }

        if (isDist) {
            System.out.println(-1);
            return;
        }

        for (int i = 0; i < n; i++) {
            if ((arr[i] & x) != arr[i] && was.contains(arr[i] & x)) {
                System.out.println(1);
                return;
            }
        }

        System.out.println(2);
    }
}


import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * @author Avto
 * @email avto.bolashvili@maxinai.com
 */
public class Problem {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int x = scanner.nextInt();

        Set<Integer> set = new HashSet<>();
        int more = 0;
        int eq = 0;
        int ans = -1;

        for (int i = 0; i < n; i++) {
            int current = scanner.nextInt();
            if (set.contains(current)) {
                ans = 0;
            } else {
                set.add(current);
            }
            if (current > x) {
                more++;
            }
            else if (current == x) {
                eq++;
            }
        }

        if (ans > -1) {
            System.out.println(ans);
            return;
        }
        if(more == 0) {
            System.out.println(-1);
            return;
        }
        if (eq == 1) {
            System.out.println(1);
        } else {
            if (more >= 1) {
                System.out.println(-1);
            } else {
                System.out.println(2);
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class B {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine().trim(), buffer[];
        buffer = line.split("\\s+");
        int N = Integer.parseInt(buffer[0]);
        int X = Integer.parseInt(buffer[1]);
        int nums[] = new int[N];
        line = br.readLine().trim();
        buffer = line.split("\\s+");
        int possible = -1;
        HashMap<Integer, Integer> set = new HashMap<>();
        for (int i = 0; i < N && possible == -1; i++) {
            nums[i] = Integer.parseInt(buffer[i]);
            if (set.containsKey(nums[i])) {
                possible = 0;
            }
            set.put(nums[i], 0);
        }
        for (int i = 0; i < N && possible == -1; i++) {
            int val = nums[i] & X;
            if (val == nums[i]) {
                continue;
            }
            if (set.containsKey(val)) {
                possible = set.get(val) + 1;
            } else {
                set.put(val, 1);
            }
        }
        System.out.println(possible);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class B {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine().trim(), buffer[];
        buffer = line.split("\\s+");
        int N = Integer.parseInt(buffer[0]);
        int X = Integer.parseInt(buffer[1]);
        line = br.readLine().trim();
        buffer = line.split("\\s+");
        int possible = (int) 1000000;
        HashMap<Integer, Integer> set = new HashMap<>();
        for (int i = 0; i < N; i++) {
            int val = Integer.parseInt(buffer[i]);
            if (set.containsKey(val)) {
                possible = Math.min(possible, set.get(val));
            } else {
                int a = val & X;
                if (set.containsKey(a)) {
                    possible = Math.min(set.get(a) + 1, possible);
                } else {
                    set.put(a, 1);
                }
                set.put(val, 0);
            }
        }
        if (possible == (int) 1000000) {
            System.out.println("-1");
        } else {
            System.out.println(possible);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class B {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine().trim(), buffer[];
        buffer = line.split("\\s+");
        int N = Integer.parseInt(buffer[0]);
        int X = Integer.parseInt(buffer[1]);
        int nums[] = new int[N];
        line = br.readLine().trim();
        buffer = line.split("\\s+");
        int possible = -1;
        HashMap<Integer, Integer> set = new HashMap<>();
        for (int i = 0; i < N && possible == -1; i++) {
            nums[i] = Integer.parseInt(buffer[i]);
            if (set.containsKey(nums[i])) {
                possible = 0;
            }
            set.put(nums[i], 0);
        }
        for (int i = 0; i < N && possible != 0; i++) {
            int val = nums[i] & X;
            if (val == nums[i]) {
                continue;
            }
            if (set.containsKey(val)) {
                if (possible == -1) {
                    possible = set.get(val) + 1;
                } else {
                    possible = Math.min(set.get(val) + 1, possible);
                }
            } else {
                set.put(val, 1);
            }
        }
        System.out.println(possible);
    }
}


import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Created by Minology on 07:42 SA
 */
public class B {

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Task solver = new Task();
        out.print(solver.solve(in, out));
        out.close();
    }

    static class Task{
        public int solve(Scanner in, PrintWriter out){
            int n, x;
            int[] a = new int[100001];
            int[] cnt = new int[100001];
            n = in.nextInt();
            x = in.nextInt();
            for(int i = 1; i <= n; ++i) a[i] = in.nextInt();
            for(int i = 1; i <= n; ++i) ++cnt[a[i]];
            for(int i = 1; i <= n; ++i) if (cnt[a[i]] > 1) return 0;
            for(int i = 1; i <= n; ++i){
                --cnt[a[i]];
                if (cnt[a[i] & x] > 0) return 1;
                ++cnt[a[i]];
            }
            return -1;
        }
    }
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#define pb push_back
#define mp make_pair
#define N 500500
using namespace std;
vector<int>g[N];
int d[N],u[N],n,m,a[7][7],x,y;
vector<int>r,o;
vector<pair<int,int> >s,e;
void rec(int x,int t){
    if ((x==e.size())||(t>m))return;
    if (t==m){
        for (int i=0;i<m;i++)printf("%d %d\n",1+s[i].first,1+s[i].second);
        exit(0);
    }
    rec(x+1,t);
    if ((d[e[x].first]==2)||(d[e[x].second]==2))return;
    ++d[e[x].first];++d[e[x].second];s.pb(e[x]);
    rec(x+1,t+1);
    --d[e[x].first];--d[e[x].second];s.pop_back();
}
void dfs(int x){
    u[x]=1;
    o.pb(x);
    for (int i=0;i<g[x].size();i++)
        if (!u[g[x][i]])dfs(g[x][i]);
}
int main(){
    scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++){
        scanf("%d%d",&x,&y);
        --x;--y;
        g[x].pb(y);
        g[y].pb(x);
        if (n<=6){a[x][y]=1;a[y][x]=1;}
    }
    if (n<=6){
        for (int i=0;i<n;i++)
            for (int j=i+1;j<n;j++)if(!a[i][j])e.pb(mp(i,j));
        rec(0,0);
        puts("-1");
        exit(0);
    }
    for (int i=0;i<n;i++)
        if (!u[i]){
            o.clear();
            dfs(i);
            for (int j=0;j<((x=o.size())+1)/2;j++){
                r.pb(o[j]);
                if (x-1-j>j)r.pb(o[x-1-j]);
            }
        }
    for (int i=0;i<m;i++)printf("%d %d\n",1+r[i],1+r[(i+3)%n]);
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#define pb push_back
#define mp make_pair
#define N 500500
using namespace std;
vector<int>g[N];
int d[N],u[N],n,m,a[7][7],x,y;
vector<int>r;
vector<pair<int,int> >s,e;
void rec(int x,int t){
    if ((x==e.size())||(t>m))return;
    if (t==m){
        for (int i=0;i<m;i++)printf("%d %d\n",1+s[i].first,1+s[i].second);
        exit(0);
    }
    rec(x+1,t);
    if ((d[e[x].first]==2)||(d[e[x].second]==2))return;
    ++d[e[x].first];++d[e[x].second];s.pb(e[x]);
    rec(x+1,t+1);
    --d[e[x].first];--d[e[x].second];s.pop_back();
}
void dfs(int x){
    u[x]=1;
    r.pb(x);
    for (int i=0;i<g[x].size();i++)
        if (!u[g[x][i]])dfs(g[x][i]);
}
int main(){
    scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++){
        scanf("%d%d",&x,&y);
        --x;--y;
        g[x].pb(y);
        g[y].pb(x);
        if (n<=6){a[x][y]=1;a[y][x]=1;}
    }
    if (n<=6){
        for (int i=0;i<n;i++)
            for (int j=i+1;j<n;j++)if(!a[i][j])e.pb(mp(i,j));
        rec(0,0);
        puts("-1");
        exit(0);
    }
    for (int i=0;i<n;i++)
        if (!u[i])dfs(i);
    for (int i=0;i<m;i++)printf("%d %d\n",1+r[i],1+r[(i+3)%n]);
}


#include <stdio.h>
#include <vector>
#include <algorithm>
#define pb push_back
#define mp make_pair
#define N 500500
using namespace std;
vector<int>g[N];
int d[N],u[N],n,m,a[7][7],x,y;
vector<int>r,o;
vector<pair<int,int> >s,e;
void rec(int x,int t){
    if (t==m){
        for (int i=0;i<m;i++)printf("%d %d\n",1+s[i].first,1+s[i].second);
        exit(0);
    }
    if (x==e.size())return;
    rec(x+1,t);
    if ((d[e[x].first]==2)||(d[e[x].second]==2))return;
    ++d[e[x].first];++d[e[x].second];s.pb(e[x]);
    rec(x+1,t+1);
    --d[e[x].first];--d[e[x].second];s.pop_back();
}
void dfs(int x){
    u[x]=1;
    o.pb(x);
    for (int i=0;i<g[x].size();i++)
        if (!u[g[x][i]])dfs(g[x][i]);
}
int main(){
    scanf("%d%d",&n,&m);
    for (int i=0;i<m;i++){
        scanf("%d%d",&x,&y);
        --x;--y;
        g[x].pb(y);
        g[y].pb(x);
        if (n<=6){a[x][y]=1;a[y][x]=1;}
    }
    if (n<=6){
        for (int i=0;i<n;i++)
            for (int j=i+1;j<n;j++)if(!a[i][j])e.pb(mp(i,j));
        rec(0,0);
        puts("-1");
        exit(0);
    }
    for (int i=0;i<n;i++)
        if (!u[i]){
            o.clear();
            dfs(i);
            for (int j=0;j<((x=o.size())+1)/2;j++){
                r.pb(o[j]);
                if (x-1-j>j)r.pb(o[x-1-j]);
            }
        }
    for (int i=0;i<m;i++)printf("%d %d\n",1+r[i],1+r[(i+3)%n]);
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <iostream>

using namespace std;

#define fr(i,a,b) for(int i=a;i<b;++i)

vector<int> inc[100100];

int v[100100];
bool rem[100100];
int n,m;

bool tem(int a, int b){
    fr(i,0,inc[a].size()) if(inc[a][i] == b) return true;
    return false;
}

bool da(){
    int nrem = n-m;
    fr(i,0,n){
        if(tem(v[i],v[i+1])){
            rem[i] = true;
            if(nrem == 0) return false;
            nrem--;
        }
    }
    return true;
}

int main(){
    srand(time(0));
    scanf("%d %d",&n,&m);
    fr(i,0,m){
        int a,b;
        scanf("%d %d",&a,&b);
        a--;
        b--;
        inc[a].push_back(b);
        inc[b].push_back(a);
    }
    fr(i,0,n){
        v[i] = i;
    }
    int n_instr = 0;
    bool foi = false;
    while(n_instr < 5000000){
        random_shuffle(v,v+n);
        v[n] = v[0];
        memset(rem, false, n*sizeof(bool));
        if(da()){
            foi = true;
            break;
        }
        n_instr += n;
    }
    if(foi){
        int cnt=0;
        fr(i,0,n){
            if(rem[i] == false && cnt < m) printf("%d %d\n",v[i]+1,v[i+1]+1), cnt++;
        }
    }
    else printf("-1\n");
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <iostream>
#include <ctime>

using namespace std;

#define fr(i,a,b) for(int i=a;i<b;++i)

vector<int> inc[100100];

int v[100100];
bool rem[100100];
int n,m;

bool tem(int a, int b){
    fr(i,0,inc[a].size()) if(inc[a][i] == b) return true;
    return false;
}

bool da(){
    int nrem = n-m;
    fr(i,0,n){
        if(tem(v[i],v[i+1])){
            rem[i] = true;
            if(nrem == 0) return false;
            nrem--;
        }
    }
    return true;
}

int main(){
    srand(time(0));
    scanf("%d %d",&n,&m);
    fr(i,0,m){
        int a,b;
        scanf("%d %d",&a,&b);
        a--;
        b--;
        inc[a].push_back(b);
        inc[b].push_back(a);
    }
    fr(i,0,n){
        v[i] = i;
    }
    int n_instr = 0;
    bool foi = false;
    while(n_instr < 5000000){
        random_shuffle(v,v+n);
        v[n] = v[0];
        memset(rem, false, n*sizeof(bool));
        if(da()){
            foi = true;
            break;
        }
        n_instr += n;
    }
    if(foi){
        int cnt=0;
        fr(i,0,n){
            if(rem[i] == false && cnt < m) printf("%d %d\n",v[i]+1,v[i+1]+1), cnt++;
        }
    }
    else printf("-1\n");
    return 0;
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <vector>
#include <ctime>

using namespace std;

typedef long long lint;

set<pair<int, int> > used;

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    for (int i = 0; i < m; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        used.insert(make_pair(a, b));
        used.insert(make_pair(b, a));
    }

    vector<int> v;

    for (int i = 1; i <= n; i++) v.push_back(i);

    clock_t s = clock();

    while (double(clock() - s) / CLOCKS_PER_SEC <= 2.8){
        random_shuffle(v.begin(), v.end());
        vector<pair<int, int> > ans;
        for (int i = 0; i < n; i++){
            if (used.find(make_pair(v[i], v[(i + 1) % n])) == used.end())
                ans.push_back(make_pair(v[i], v[(i + 1) % n]));
            if (ans.size() == m){
                for (int j = 0; j < m; j++)
                    printf("%d %d\n", ans[j].first, ans[j].second);
                return (0);
            }
        }
    }
    printf("-1\n");
    return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    for (int i = 0; i < m; i++){
        int a, b;
        scanf("%d %d", &a, &b);
        used[--a].insert(--b);
        used[b].insert(a);
    }

    if (n <= 7){
        pair<int, int> a[256];
        int k = 0;
        for (int i = 0; i < n; i++){
            for (int j = i + 1; j < n; j++){
                a[k++] = make_pair(i, j);
            }
        }

        for (int i = 0; i < (1 << k); i++){
            if (__builtin_popcount(i) == m){
                bool ok = true;
                int count[256] = {0};
                for (int j = 0; j < k; j++){
                    if ((i >> j) & 1){
                        if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
                            ok = false;
                        }
                        count[a[j].first]++; count[a[j].second]++;
                        if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
                    }
                }
                if (ok){
                    for (int j = 0; j < k; j++){
                        if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
                    }
                    return (0);
                }
            }
        }
        printf("-1\n");
    }
    else {
        int it = 0, vert = 0;
        int count[100000] = {0};
        pair<int, int> ans[100000];
        while (it < n){
            while (count[it] < 2){
                int x = (unsigned int)(rand() * rand() - rand()) % n;
                if (x != it && used[it].find(x) == used[it].end() && count[x] < 2){
                    ans[vert++] = make_pair(x, it);
                    count[it]++; count[x]++;
                    used[x].insert(it); used[it].insert(x);
                }
                if (vert == m){
                    for (int i = 0; i < m; i++){
                        printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
                    }
                    return (0);
                }
            }
            it++;
        }
        printf("-1\n");
    }

    return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		used[--a].insert(--b);
		used[b].insert(a);
	}

	if (n <= 6){
		pair<int, int> a[256];
		int k = 0;
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				a[k++] = make_pair(i, j);
			}
		}

		for (int i = 0; i < (1 << k); i++){
			if (__builtin_popcount(i) == m){
				bool ok = true;
				int count[256] = {0};
				for (int j = 0; j < k; j++){
					if ((i >> j) & 1){
						if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
							ok = false;
						}
						count[a[j].first]++; count[a[j].second]++;
						if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
					}
				}
				if (ok){
					for (int j = 0; j < k; j++){
						if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
					}
					return (0);
				}
			}
		}
		printf("-1\n");
	}
	else {
		int it = 0, vert = 0;
		int count[100000] = {0};

		while (vert < m){
			while (count[it] < 2){
				int x = (unsigned int)(rand() * rand() - rand()) % n;
				if (x != it && used[it].find(x) == used[it].end() && count[x] < 2){
					printf("%d %d\n", it + 1, x + 1);
					vert++;
					count[it]++; count[x]++;
					used[x].insert(it); used[it].insert(x);
				}
				if (vert == m) return (0);
			}
			it++;
		}
		printf("-1\n");
	}

	return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		used[--a].insert(--b);
		used[b].insert(a);
	}

	if (n <= 7){
		pair<int, int> a[256];
		int k = 0;
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				a[k++] = make_pair(i, j);
			}
		}

		for (int i = 0; i < (1 << k); i++){
			if (__builtin_popcount(i) == m){
				bool ok = true;
				int count[256] = {0};
				for (int j = 0; j < k; j++){
					if ((i >> j) & 1){
						if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
							ok = false;
						}
						count[a[j].first]++; count[a[j].second]++;
						if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
					}
				}
				if (ok){
					for (int j = 0; j < k; j++){
						if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
					}
					return (0);
				}
			}
		}
		printf("-1\n");
	}
	else {
		int it = 0, vert = 0;
		int count[100000] = {0};
		pair<int, int> ans[100000];
		while (it < n){
			int chal = 1000;
			while (count[it] < 2 && chal--){
				int x = (unsigned int)(rand() * rand() - rand()) % n;
				if (x != it && used[it].find(x) == used[it].end() && count[x] < 2){
					ans[vert++] = make_pair(x, it);
					count[it]++; count[x]++;
					used[x].insert(it); used[it].insert(x);
				}
				if (vert == m){
					for (int i = 0; i < m; i++){
						printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
					}
					return (0);
				}
			}
			it++;
		}
		printf("-1\n");
	}

	return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		used[--a].insert(--b);
		used[b].insert(a);
	}

	if (n <= 6){
		pair<int, int> a[256];
		int k = 0;
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				a[k++] = make_pair(i, j);
			}
		}

		for (int i = 0; i < (1 << k); i++){
			if (__builtin_popcount(i) == m){
				bool ok = true;
				int count[256] = {0};
				for (int j = 0; j < k; j++){
					if ((i >> j) & 1){
						if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
							ok = false;
						}
						count[a[j].first]++; count[a[j].second]++;
						if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
					}
				}
				if (ok){
					for (int j = 0; j < k; j++){
						if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
					}
					return (0);
				}
			}
		}
		printf("-1\n");
	}
	else {
		int it = 0, vert = 0;
		int count[100000] = {0};
		pair<int, int> ans[100000];
		while (vert < m){
			int chal = 1000;
			while (count[it] < 2 && chal--){
				int x = (unsigned int)(rand() * rand() - rand()) % n;
				if (x != it && used[it].find(x) == used[it].end() && count[x] < 2){
					ans[vert++] = make_pair(x, it);
					count[it]++; count[x]++;
					used[x].insert(it); used[it].insert(x);
				}
				if (vert == m){
					for (int i = 0; i < m; i++){
						printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
					}
					return (0);
				}
			}
			it++;
		}
		printf("-1\n");
	}

	return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		used[--a].insert(--b);
		used[b].insert(a);
	}

	if (n <= 7){
		pair<int, int> a[256];
		int k = 0;
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				a[k++] = make_pair(i, j);
			}
		}

		for (int i = 0; i < (1 << k); i++){
			if (__builtin_popcount(i) == m){
				bool ok = true;
				int count[256] = {0};
				for (int j = 0; j < k; j++){
					if ((i >> j) & 1){
						if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
							ok = false;
						}
						count[a[j].first]++; count[a[j].second]++;
						if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
					}
				}
				if (ok){
					for (int j = 0; j < k; j++){
						if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
					}
					return (0);
				}
			}
		}
		printf("-1\n");
	}
	else {
		int it = 0, vert = 0;
		int count[100000] = {0};

		while (vert < m){
			while (count[it] < 2){
				int x = (unsigned int)(rand() * rand() - rand()) % n;
				if (x != it && used[it].find(x) == used[it].end() && count[x] < 2){
					printf("%d %d\n", it + 1, x + 1);
					vert++;
					count[it]++; count[x]++;
					used[x].insert(it); used[it].insert(x);
				}
				if (vert == m) return (0);
			}
			it++;
		}
	}

	return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		used[--a].insert(--b);
		used[b].insert(a);
	}

	if (n <= 7){
		pair<int, int> a[256];
		int k = 0;
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				a[k++] = make_pair(i, j);
			}
		}

		for (int i = 0; i < (1 << k); i++){
			if (__builtin_popcount(i) == m){
				bool ok = true;
				int count[256] = {0};
				for (int j = 0; j < k; j++){
					if ((i >> j) & 1){
						if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
							ok = false;
						}
						count[a[j].first]++; count[a[j].second]++;
						if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
					}
				}
				if (ok){
					for (int j = 0; j < k; j++){
						if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
					}
					return (0);
				}
			}
		}
		printf("-1\n");
	}
	else {
		int it = 0, vert = 0;
		int count[100000] = {0};
		pair<int, int> ans[100000];
		while (vert < m){
			int chal = 1000;
			while (count[it] < 2 && chal--){
				int x = (unsigned int)(rand() * rand() - rand()) % n;
				if (x != it && used[it].find(x) == used[it].end() && count[x] < 2){
					ans[vert++] = make_pair(x, it);
					count[it]++; count[x]++;
					used[x].insert(it); used[it].insert(x);
				}
				if (vert == m){
					for (int i = 0; i < m; i++){
						printf("%d %d\n", ans[i].first + 1, ans[i].second + 1);
					}
					return (0);
				}
			}
			it++;
		}
		printf("-1\n");
	}

	return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		used[--a].insert(--b);
		used[b].insert(a);
	}

	if (n <= 7){
		pair<int, int> a[256];
		int k = 0;
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				a[k++] = make_pair(i, j);
			}
		}

		for (int i = 0; i < (1 << k); i++){
			if (__builtin_popcount(i) == m){
				bool ok = true;
				int count[256] = {0};
				for (int j = 0; j < k; j++){
					if ((i >> j) & 1){
						if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
							ok = false;
						}
						count[a[j].first]++; count[a[j].second]++;
						if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
					}
				}
				if (ok){
					for (int j = 0; j < k; j++){
						if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
					}
					return (0);
				}
			}
		}
		printf("-1\n");
	}
	else {
		int it = 0, vert = 0;
		int count[100000] = {0};

		while (vert < m){
			while (count[it] < 2){
				int x = (unsigned int)(rand() * rand() - rand()) % n;
				if (x != it && used[it].find(x) == used[it].end()){
					printf("%d %d\n", it + 1, x + 1);
					vert++;
					count[it]++; count[x]++;
					used[x].insert(it); used[it].insert(x);
				}
				if (vert == m) return (0);
			}
			it++;
		}
	}

	return (0);
}


#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>

using namespace std;

typedef long long lint;

set<int> used[100000];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 0; i < m; i++){
		int a, b;
		scanf("%d %d", &a, &b);
		used[--a].insert(--b);
		used[b].insert(a);
	}

	if (n <= 6){
		pair<int, int> a[256];
		int k = 0;
		for (int i = 0; i < n; i++){
			for (int j = i + 1; j < n; j++){
				a[k++] = make_pair(i, j);
			}
		}

		for (int i = 0; i < (1 << k); i++){
			if (__builtin_popcount(i) == m){
				bool ok = true;
				int count[256] = {0};
				for (int j = 0; j < k; j++){
					if ((i >> j) & 1){
						if (used[a[j].first].find(a[j].second) != used[a[j].first].end()){
							ok = false;
						}
						count[a[j].first]++; count[a[j].second]++;
						if (count[a[j].first] > 2 || count[a[j].second] > 2) ok = false;
					}
				}
				if (ok){
					for (int j = 0; j < k; j++){
						if ((i >> j) & 1) printf("%d %d\n", a[j].first + 1, a[j].second + 1);
					}
					return (0);
				}
			}
		}
		printf("-1\n");
	}
	else {
		int it = 0, vert = 0;
		int count[100000] = {0};

		while (vert < m){
			int chal = 1000;
			while (count[it] < 2 && chal--){
				int x = (unsigned int)(rand() * rand() - rand()) % n;
				if (x != it && used[it].find(x) == used[it].end() && count[x] < 2){
					printf("%d %d\n", it + 1, x + 1);
					vert++;
					count[it]++; count[x]++;
					used[x].insert(it); used[it].insert(x);
				}
				if (vert == m) return (0);
			}
			it++;
		}
		printf("-1\n");
	}

	return (0);
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    if(m>0) printf("%d %d\n",b[b.size()-1],b[0]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
    }
    if(n==2)
        puts("Impossible");
    else if(n==3&&!three())
        puts("Impossible");
    else if(n==4&&!four())
        puts("Impossible");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    if(m>0) printf("%d %d\n",b[b.size()-1],b[0]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/
if(m==0)    return;
    if(m==1){

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
    }
    else
    {
    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) )
       &&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        printf("%d %d\n",w[w.size()-1],b[0]),

        printf("%d %d\n",w[w.size()-1],b[0]);
    else
        printf("%d %d\n",b[b.size()-1],b[0]),
        printf("%d %d\n",w[w.size()-1],w[0]);
    }
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[b.size()-1]) ))
        m--,printf("%d %d\n",w[b.size()-1],b[0]);

    if(m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(m&&!mm.count( make_pair(w[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[b.size()-1]) ))
        m--,printf("%d %d\n",w[b.size()-1],w[0]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],6-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==0&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=num;i>0;--i)
        b.push_back(r[i][0]);
    for(int i=num;i>0;--i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/
if(m==0)    return;
    if(m==1){

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
    }
    else
    {
        if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) )
           &&w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
            printf("%d %d\n",b[b.size()-1],b[0]),printf("%d %d\n",w[w.size()-1],w[0]);
        else if(!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) )
       &&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        printf("%d %d\n",b[b.size()-1],w[0]),

        printf("%d %d\n",w[w.size()-1],b[0]);
        else

        printf("%d %d\n",b[b.size()-1],w[w.size()-1]),

        printf("%d %d\n",w[0],b[0]);
    }
}
/*5 5
5 4
1 5
2 1
3 2
3 4
1 2 3 4 5
1 3 5 2 4*/
/*
2 5
1 4 3
1 2 4 3 5*/
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3)
    {
        if(!three())
        puts("-1");
    }
    else if(n==4){
        if(!four())
        puts("-1");
    }else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=num;i>0;--i)
        b.push_back(r[i][0]);
    for(int i=num;i>0;--i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/
if(m==0)    return;
    if(m==1){

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
    }
    else
    {
        if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) )
           &&w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
            printf("%d %d\n",b[b.size()-1],b[0]),printf("%d %d\n",w[w.size()-1],w[0]);
        else if(!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) )
       &&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        printf("%d %d\n",b[b.size()-1],w[0]),

        printf("%d %d\n",w[w.size()-1],b[0]);
        else

        printf("%d %d\n",b[b.size()-1],w[w.size()-1]),

        printf("%d %d\n",w[0],b[0]);
    }
}
/*5 5
5 4
1 5
2 1
3 2
3 4
1 2 3 4 5
1 3 5 2 4*/
/*
2 5
1 4 3
1 2 4 3 5*/
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);

    if(m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[b.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[b.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/
if(m==0)    return;
    if(m==1){

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
    }
    else
    {
        if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) )
           &&w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
            printf("%d %d\n",b[b.size()-1],b[0]),printf("%d %d\n",w[w.size()-1],w[0]);
        else if(!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) )
       &&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        printf("%d %d\n",b[b.size()-1],w[0]),

        printf("%d %d\n",w[w.size()-1],b[0]);
        else

        printf("%d %d\n",b[b.size()-1],w[w.size()-1]),

        printf("%d %d\n",w[0],b[0]);
    }
}
/*5 5
5 4
1 5
2 1
3 2
3 4
1 2 3 4 5
1 3 5 2 4*/
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/
if(m==0)    return;
    if(m==1){

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
    }
    else
    {
        if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) )
           &&w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
            printf("%d %d\n",b[b.size()-1],b[0]),printf("%d %d\n",w[w.size()-1],w[0]);
        else if(!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) )
       &&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        printf("%d %d\n",b[w.size()-1],w[0]),

        printf("%d %d\n",w[w.size()-1],b[0]);
        else

        printf("%d %d\n",b[w.size()-1],w[w.size()-1]),

        printf("%d %d\n",w[0],b[0]);
    }
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==0&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=num;i>0;--i)
        b.push_back(r[i][0]);
    for(int i=num;i>0;--i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/
if(m==0)    return;
    if(m==1){

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
    }
    else
    {
        if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) )
           &&w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
            printf("%d %d\n",b[b.size()-1],b[0]),printf("%d %d\n",w[w.size()-1],w[0]);
        else if(!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) )
       &&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        printf("%d %d\n",b[b.size()-1],w[0]),

        printf("%d %d\n",w[w.size()-1],b[0]);
        else

        printf("%d %d\n",b[b.size()-1],w[w.size()-1]),

        printf("%d %d\n",w[0],b[0]);
    }
}
/*5 5
5 4
1 5
2 1
3 2
3 4
1 2 3 4 5
1 3 5 2 4*/
/*
2 5
1 4 3
1 2 4 3 5*/
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;--i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==0&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=num;i>0;--i)
        b.push_back(r[i][0]);
    for(int i=num;i>0;--i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/
if(m==0)    return;
    if(m==1){

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
    }
    else
    {
        if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) )
           &&w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
            printf("%d %d\n",b[b.size()-1],b[0]),printf("%d %d\n",w[w.size()-1],w[0]);
        else if(!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) )
       &&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        printf("%d %d\n",b[b.size()-1],w[0]),

        printf("%d %d\n",w[w.size()-1],b[0]);
        else

        printf("%d %d\n",b[b.size()-1],w[w.size()-1]),

        printf("%d %d\n",w[0],b[0]);
    }
}
/*5 5
5 4
1 5
2 1
3 2
3 4
1 2 3 4 5
1 3 5 2 4*/
/*
2 5
1 4 3
1 2 4 3 5*/
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3)
    {
        if(!three())
        puts("-1");
    }
    else if(n==4){
        if(!four())
        puts("-1");
    }else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)if(!g[i][j])
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=1;i<=num;++i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);
/*
6 6
1 4
1 2
4 2
3 5
3 6
5 6
1 4 2
3 5 6
1 3 2 6 4 5
*/

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<w.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);

    if(b.size()>2&&m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(w.size()>2&&m&&!mm.count( make_pair(w[w.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],w[0]);

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[w.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[w.size()-1]) ))
        m--,printf("%d %d\n",w[w.size()-1],b[0]);

}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}


#include<cstdio>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

vector<int>g[110000];
int u[110000],v[110000],n,m;
int cnt[110000];
bool three()
{
    if(m>1) return false;
    printf("%d %d\n",u[0],5-u[0]-v[0]);
    return true;
}
bool four()
{
    if(m>3) return false;
    for(int i=1;i<=4;++i)if(cnt[i]==3&&m==3)
        return false;
    int g[5][5];
    for(int i=1;i<=4;++i)
        for(int j=1;j<=4;++j)   g[i][j]=0;
    for(int i=0;i<m;++i)
        g[u[i]][v[i]]=g[v[i]][u[i]]=1;
    for(int i=1;i<4;++i)
    {
        for(int j=i+1;j<=4&&m;++j)
        {
            printf("%d %d\n",i,j);
            m--;
        }
    }
    return true;
}
int vis[110000];
vector<int>r[110000];
vector<int>b;
vector<int>w;
map<pair<int,int>,int>mm;
void dfs(vector<int>&tmp, int x)
{
    tmp.push_back(x);
    vis[x]=1;
    for(int i=0;i<g[x].size();++i)if(!vis[g[x][i]])
        dfs(tmp,g[x][i]);
}
void gao()
{
    int num=0;
    for(int i=1;i<=n;++i)if(cnt[i]==1&&!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    for(int i=1;i<=n;++i)if(!vis[i])
    {
        num++;
        dfs(r[num],i);
    }
    //1 2 3 4
    //5
    //1 5 3 2 4
    for(int i=1;i<=num;++i)
        b.push_back(r[i][0]);
    for(int i=1;i<=num;++i)
        for(int j=2;j<r[i].size();j+=2)
            b.push_back(r[i][j]);
    for(int i=num;i>0;--i)
        for(int j=1;j<r[i].size();j+=2)
            w.push_back(r[i][j]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",b[i-1],b[i]);
    for(int i=1;m&&i<b.size();++i)
        m--,printf("%d %d\n",w[i-1],w[i]);

    if(m&&!mm.count( make_pair(b[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],w[0]);

    if(m&&!mm.count( make_pair(w[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],w[b.size()-1]) ))
        m--,printf("%d %d\n",w[b.size()-1],b[0]);

    if(m&&!mm.count( make_pair(b[b.size()-1],b[0]) )
       &&!mm.count( make_pair(b[0],b[b.size()-1]) ))
        m--,printf("%d %d\n",b[b.size()-1],b[0]);

    if(m&&!mm.count( make_pair(w[b.size()-1],w[0]) )
       &&!mm.count( make_pair(w[0],w[b.size()-1]) ))
        m--,printf("%d %d\n",w[b.size()-1],w[0]);
}
int main()
{
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>u[i]>>v[i];
        g[u[i]].push_back(v[i]);
        g[v[i]].push_back(u[i]);
        cnt[u[i]]++;
        cnt[v[i]]++;
        mm[make_pair(u[i],v[i])]=1;
    }
    if(n==2)
        puts("-1");
    else if(n==3&&!three())
        puts("-1");
    else if(n==4&&!four())
        puts("-1");
    else
        gao();
    return 0;
}