#include <bits/stdc++.h>
using namespace std;
int p[1005];
int a[1005];
void init() {
  for (int i = 0; i <= 1000; i++) p[i] = i;
}
int cha(int x) {
  if (x != p[x]) {
    p[x] = cha(p[x]);
  }
  return p[x];
}
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    init();
    int cnt = 0;
    int sum = 0;
    int flag = 0;
    memset(a, 0, sizeof(a));
    for (int i = 0; i < m; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      int xx = cha(x);
      int yy = cha(y);
      if (a[x] == 0) sum++, a[x]++;
      if (a[y] == 0) sum++, a[y]++;
      if (xx != yy) {
        p[xx] = yy;
      } else {
        flag = 1;
      }
    }
    if (sum != n) flag = 1;
    if (flag)
      printf("no\n");
    else
      printf("yes\n");
  }
}
