#include <bits/stdc++.h>
const int MAXN = 10001;
int n, m, f[MAXN];
int getfa(int x) { return f[x] ? f[x] = getfa(f[x]) : x; }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    int fx = getfa(x), fy = getfa(y);
    if (fx == fy) return puts("no"), 0;
    f[fx] = fy;
    n--;
  }
  if (n != 1) return puts("no"), 0;
  puts("yes");
  return 0;
}
