#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, a[1010], vis[1010];
int cha(int x) {
  if (a[x] != x) a[x] = cha(a[x]);
  return a[x];
}
int bing(int l, int r) {
  int A = cha(l);
  int B = cha(r);
  if (A == B)
    return 0;
  else
    return a[A] = B;
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    int sum = 0, flag = 1;
    for (int i = 1; i <= n; i++) a[i] = i;
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= m; i++) {
      scanf("%d%d", &l, &r);
      vis[l] = 1;
      vis[r] = 1;
      cha(l);
      cha(r);
      if (a[l] == a[r]) flag = 0;
      if (l > r) swap(l, r);
      bing(l, r);
      sum++;
    }
    int dian = 0;
    for (int i = 0; i <= 1010; i++) {
      if (vis[i] == 1) {
        dian++;
      }
    }
    if (flag && dian == 0) {
      printf("yes\n");
      continue;
    }
    if (flag && sum + 1 == dian)
      printf("yes\n");
    else
      printf("no\n");
  }
  return 0;
}
