#include <bits/stdc++.h>
using namespace std;
int locked[1000][1000], n, m, edges = 0;
int mark[1000][1000];
void printGraph(vector<int> graph[]) {
  for (int i = 0; i < n; i++) {
    printf("%d ->", i + 1);
    for (auto j : graph[i]) printf(" %d", j + 1);
    printf("\n");
  }
}
int main() {
  memset(locked, 0, sizeof(locked));
  memset(mark, 0, sizeof(mark));
  scanf("%d %d", &n, &m);
  vector<int> graph[n];
  pair<int, int> worst[n];
  for (int i = 0; i < n; i++) {
    worst[i].first = n - 1;
    worst[i].second = i;
  }
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    locked[u][v] = locked[v][u] = 1;
    worst[u].first--;
    worst[v].first--;
  }
  sort(worst, worst + n);
  if (0)
    for (int i = 0; i < n; i++)
      printf("%d %d\n", worst[i].first, worst[i].second + 1);
  printf("%d\n", n - 1);
  int edges = n - 1, at = n - 1;
  while (edges) {
    for (int i = 0; i < n && edges; i++)
      if (!locked[i][worst[at].second] && worst[at].first &&
          worst[at].second != i) {
        printf("%d %d\n", i + 1, worst[at].second + 1);
        worst[at].first--;
        edges--;
      }
    n--;
  }
  return (0);
}
