#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
template <class T>
bool scanff(T &ret) {
  char c;
  int sgn;
  T bit = 0.1;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && c != '.' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  if (c == ' ' || c == '\n') {
    ret *= sgn;
    return 1;
  }
  while (c = getchar(), c >= '0' && c <= '9') ret += (c - '0') * bit, bit /= 10;
  ret *= sgn;
  return 1;
}
using namespace std;
int f[100100];
int find(int x) {
  for (; x != f[x];) x = f[x] = f[f[x]];
  return x;
}
int main() {
  int n, m;
  scanff(n);
  scanff(m);
  for (int i = int(1); i <= int(n); i++) f[i] = i;
  for (int i = int(1); i <= int(m); i++) {
    int x, y;
    scanff(x);
    scanff(y);
    int xx = find(x);
    int yy = find(y);
    f[yy] = xx;
  }
  int pd = 0;
  for (int i = int(2); i <= int(n); i++) {
    if (find(i) != find(1)) pd = 1;
  }
  if (pd == 0 && m == n - 1) {
    printf("yes\n");
  } else
    printf("no\n");
  return 0;
}
