#include <bits/stdc++.h>
using namespace std;
bool ok, ok2;
int n, m, nnow;
vector<vector<int> > gr;
vector<int> color;
pair<int, int> BFS(int src) {
  if (gr[src].size() == 0) return make_pair(src, src);
  color[src] = 1;
  pair<int, int> res(-1, -1);
  queue<int> q;
  q.push(src);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    if (gr[v].size() == 1) {
      if (res.first == -1)
        res.first = v;
      else
        res.second = v;
    }
    for (int i = 0; i < gr[v].size(); i++)
      if (color[gr[v][i]] == 0) {
        color[gr[v][i]] = 1;
        q.push(gr[v][i]);
      }
  }
  return make_pair(min(res.first, res.second), max(res.first, res.second));
}
int main() {
  cin >> n >> m;
  if (n == 1) {
    if (m > 1) {
      cout << "NO";
      return 0;
    }
    cout << "YES" << endl;
    if (m == 1) cout << 0;
    if (m == 0) cout << 1 << endl << "1 1";
    return 0;
  }
  gr.resize(n);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    if (x == y) {
      cout << "NO";
      return 0;
    }
    x--;
    y--;
    gr[x].push_back(y);
    gr[y].push_back(x);
  }
  for (int i = 0; i < n; i++)
    if (gr[i].size() > 2) {
      cout << "NO";
      return 0;
    }
  ok = true;
  ok2 = false;
  nnow = 0;
  color.assign(n, 0);
  BFS(0);
  for (int i = 0; i < n; i++)
    if (gr[i].size() != 2 || color[i] == 0) ok = false;
  if (ok) {
    cout << "YES" << endl << 0;
    return 0;
  }
  color.assign(n, 0);
  vector<pair<int, int> > comp;
  for (int i = 0; i < n; i++)
    if (color[i] == 0) {
      pair<int, int> x = BFS(i);
      if (x.second == -1) {
        cout << "NO";
        return 0;
      }
      comp.push_back(x);
    }
  cout << "YES" << endl << comp.size();
  if (comp.empty()) return 0;
  cout << endl;
  while (comp.size() > 1) {
    vector<pair<int, int> > tmp;
    sort(comp.begin(), comp.end());
    cout << comp[0].first + 1 << " " << comp[1].first + 1 << endl;
    comp[0] = make_pair(comp[0].second, comp[1].second);
    if (comp[0].second < comp[0].first) swap(comp[0].first, comp[0].second);
    tmp.push_back(comp[0]);
    for (int j = 2; j < comp.size(); j++) tmp.push_back(comp[j]);
    comp = tmp;
  }
  cout << comp[0].first + 1 << " " << comp[0].second + 1;
  return 0;
}
