#include <bits/stdc++.h>
using namespace std;
int n, m;
int x, y;
int p[1010], r[1010];
int findpar(int x) { return (x == p[x]) ? x : findpar(p[x]); }
void gabung(int x, int y) {
  if (r[x] > r[y]) {
    p[y] = p[x];
  } else {
    r[y]++;
    p[x] = p[y];
  }
}
int main() {
  scanf("%d %d", &m, &n);
  int ctr = n;
  for (int i = 0; i <= m; i++) {
    p[i] = i;
    r[i] = 1;
  }
  while (ctr--) {
    scanf("%d%d", &x, &y);
    int xx, yy;
    xx = findpar(x);
    yy = findpar(y);
    if (xx == yy) {
      printf("no\n");
      return 0;
    }
    gabung(xx, yy);
  }
  (n == m - 1) ? printf("yes\n") : printf("no\n");
}
