#include <bits/stdc++.h>
using namespace std;
int p[1005];
int Find(int x) { return (x == p[x]) ? x : p[x] = Find(p[x]); }
int main() {
  int n, m;
  int a, b, pa, pb;
  scanf("%d%d", &n, &m);
  if (m != n - 1) {
    printf("no\n");
    return 0;
  }
  bool flag = false;
  for (int i = 1; i <= n; i++) {
    p[i] = i;
  }
  for (int j = 0; j < m; j++) {
    scanf("%d%d", &a, &b);
    pa = Find(a);
    pb = Find(b);
    if (pa != pb) {
      p[pb] = pa;
    } else {
      flag = true;
      break;
    }
  }
  int num = 0;
  for (int i = 1; i <= n; i++) {
    if (Find(i) == i) {
      num++;
    }
    if (num > 1) {
      flag = true;
      break;
    }
  }
  if (flag == true) {
    printf("no\n");
  } else {
    printf("yes\n");
  }
  return 0;
}
