#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y;
  cin >> n >> m;
  vector<pair<int, int>> arr;
  for (int i = 0; i < n; i++) {
    arr.push_back(make_pair(0, i + 1));
  }
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    arr[--x].first++;
    arr[--y].first++;
  }
  sort(arr.begin(), arr.end());
  cout << n - 1 << endl;
  for (int i = 1; i < n; i++) {
    cout << arr[0].second << " " << arr[i].second << endl;
  }
}
