#include <bits/stdc++.h>
using namespace std;
class DSU {
 public:
  vector<int> parent;
  int total_components;
  DSU(int n) {
    parent.resize(n + 1);
    for (int i = 1; i <= n; i++) {
      parent[i] = i;
    }
    total_components = n;
  }
  int get(int x) {
    if (parent[x] == x) {
      return x;
    }
    return parent[x] = get(parent[x]);
  }
  bool unite(int x, int y) {
    int p1 = get(x);
    int p2 = get(y);
    if (p1 == p2) {
      return true;
    }
    parent[p1] = p2;
    total_components--;
    return false;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  bool cycle = false;
  DSU g(n);
  while (m--) {
    int u, v;
    cin >> u >> v;
    if (g.unite(u, v)) {
      cycle = true;
    }
  }
  if (cycle || g.total_components > 1) {
    cout << "no" << endl;
  } else {
    cout << "yes" << endl;
  }
  cout.flush();
  return 0;
}
