#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN=1e5+5;
const int MAXM=1e6+5;
int n,m;
pair<int,int> a[MAXM];
vector<int> lan[MAXN];
bool usedl[MAXN];
bool usedc[MAXM];
vector<pair<int,int> > ans;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m;
for(int i=1;i<=m;i++)
{
    cin>>a[i].first>>a[i].second;
    lan[a[i].first].push_back(i);
    lan[a[i].second].push_back(i);
}
int idx=1;
int ffree=1;
for(;;)
{
    if(ffree==n+1) break;
    usedl[idx]=1;
    bool fl=0;
    for(int i=ffree;i<=n;i++)
    {
        if(!usedl[i])
        {
            ffree=i;
            fl=1;
            break;
        }
    }
    if(!fl) ffree=n+1;
    int c1=0,c2=0;
    for(int i=0;i<lan[idx].size();i++)
    {
        if(c1)
        {
            if(!usedc[lan[idx][i]]) c2=lan[idx][i];
            else continue;
            usedc[c1]=usedc[c2]=1;
            ans.push_back({c1,c2});
            c1=c2=0;
        }
        else if(!usedc[lan[idx][i]]) c1=lan[idx][i];
    }
    if(c1)
    {
        if(idx!=a[c1].first && !usedl[a[c1].first]) idx=a[c1].first;
        else if(!usedl[a[c1].second])idx=a[c1].second;
        else idx=ffree;
    }
    else idx=ffree;
}
cout<<ans.size()<<endl;
for(int i=0;i<ans.size();i++) cout<<ans[i].first<<" "<<ans[i].second<<endl;
return 0;
}
