#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, r, m, s, t, n, h, a[112136], b[123456], z, c[168456],
    d[17456], za[1234];
vector<long long> p[400], q;
pair<long long, long long> yy[2345];
long long xx, x, y;
int main() {
  cin >> n >> m;
  if (n < m) {
    cout << "NO";
    return 0;
  }
  for (i = 1; i <= n; i++) {
    c[i] = i;
    d[i] = 1;
  }
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    if (x == y && n > 1) {
      cout << "NO";
      return 0;
    }
    a[x]++;
    a[y]++;
    if (c[x] == c[y]) {
      if (i + 1 == n) {
        cout << "YES\n0";
      } else
        cout << "NO";
      return 0;
    }
    t = c[y];
    for (j = 1; j <= n; j++)
      if (c[j] == t) c[j] = c[x];
  }
  for (i = 1; i <= n; i++) {
    if (a[i] > 2) {
      cout << "NO";
      return 0;
    }
    if (a[i] == 0) {
      q.push_back(i);
      q.push_back(i);
      za[i] = 1;
    }
  }
  for (i = 1; i <= n; i++) {
    if (za[i] == 0) {
      for (j = 1; j <= n; j++) {
        if (c[j] == c[i]) {
          za[j] = 1;
          if (a[j] == 1) {
            q.push_back(j);
          }
        }
      }
    }
  }
  cout << "YES\n" << n - m << '\n';
  for (i = 0; i < q.size(); i += 2) {
    yy[s].first = min(q[i], q[i + 1]);
    yy[s].second = max(q[i], q[i + 1]);
    s++;
  }
  for (i = 1; i < s; i++) {
    sort(yy, yy + s);
    cout << yy[0].first << ' ' << yy[1].first << endl;
    x = yy[0].second;
    y = yy[1].second;
    yy[0].first = min(x, y);
    yy[0].second = max(x, y);
    yy[1].first = 123456;
    yy[1].second = 1234567;
  }
  sort(yy, yy + s);
  cout << yy[0].first << ' ' << yy[0].second;
  return 0;
}
