def main(): N, M = map(int, input().split()) T = {tuple(map(int, input().split())) for _ in [0] * M} if M == 1: print('YES') exit() station = [0] * N for a, b in T: station[a] += 1 station[b] += 1 cnt = tuple(filter(lambda n:n==2, station)) if len(cnt) == M - 1: print('YES') else: print('NO') main()