#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "yes" : "no");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
}
void et() {
  puts("-1");
  exit(0);
}
int f[1005];
int ff(int x) { return x == f[x] ? x : f[x] = ff(f[x]); }
void fmain() {
  scanf("%d%d", &n, &m);
  for (int(i) = 1; (i) <= (int)(n); (i)++) f[i] = i;
  for (int u, v, i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    int fu = ff(u), fv = ff(v);
    if (fu == fv) etp();
    f[fu] = fv;
  }
  int F = ff(1);
  for (int i = 2; i <= n; i++)
    if (ff(i) != F) etp();
  etp(1);
}
int main() {
  fmain();
  return 0;
}
