#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int N = 1e3 + 10;
int n, m;
vector<int> g[N];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int id = -1;
  for (int i = 1; i <= n; i++) {
    if (id == -1 || (int)(g[i]).size() < (int)(g[id]).size()) {
      id = i;
    }
  }
  printf("%d\n", n - 1);
  for (int i = 1; i <= n; i++) {
    if (id != i) {
      printf("%d %d\n", id, i);
    }
  }
  return 0;
}
