#include <bits/stdc++.h>
using namespace std;
int fa[1005];
int find(int x) { return (fa[x] == x) ? x : fa[x] = find(fa[x]); }
void merge(int x, int y) { fa[find(x)] = find(y); }
bool query(int x, int y) { return find(x) == find(y); }
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) fa[i] = i;
  int x, y;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    if (query(x, y)) {
      puts("no");
      return 0;
    } else
      merge(x, y);
  }
  if (m != n - 1)
    puts("no");
  else
    puts("yes");
  return 0;
}
