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