#include <bits/stdc++.h>
using namespace std;
int r[10004], par[10004];
int find(int x) {
  if (par[x] != x) par[x] = find(par[x]);
  return par[x];
}
void union1(int a, int b) {
  int x = find(a), y = find(b);
  if (r[x] > r[y]) {
    par[y] = x;
    r[x] += 1;
  } else {
    par[x] = y;
    r[y] += 1;
  }
}
int main(void) {
  int n, m;
  int a, b;
  scanf("%d %d", &n, &m);
  if (m != n - 1) {
    printf("no\n");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    r[i] = 1;
    par[i] = i;
  }
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &a, &b);
    if (find(a) != find(b))
      union1(a, b);
    else {
      printf("no\n");
      return 0;
    }
  }
  printf("yes\n");
  return 0;
}
