#include <bits/stdc++.h>
using namespace std;
int p[1000000];
int parent(int x) { return p[x] = ((p[x] == x) ? x : parent(p[x])); }
void join(int x, int y) { p[parent(x)] = parent(y); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, ans = 1, u, v;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) p[i] = i;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    if (parent(u) == parent(v))
      ans = 0;
    else
      join(u, v);
  }
  for (int i = 2; i <= n; i++) {
    if (parent(i) != parent(i - 1)) {
      ans = 0;
      break;
    }
  }
  cout << ((ans) ? "yes" : "no");
  return 0;
}
