#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
int f[N];
int k(int w) {
  if (f[w] != w) {
    f[w] = k(f[w]);
  }
  return f[w];
}
int main() {
  int q, w, e, r, t, numEdg;
  cin >> q >> numEdg;
  for (w = 0; w < q; w++) {
    f[w] = w;
  }
  for (w = 0; w < numEdg; w++) {
    scanf("%d%d", &e, &r);
    e--;
    r--;
    if (k(e) == k(r)) {
      printf("no");
      return 0;
    }
    f[k(e)] = k(r);
  }
  if (numEdg != q - 1) {
    cout << "no";
  } else {
    cout << "yes";
  }
  return 0;
}
