nicoella's Amazing Alts


Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

To remember how many alts that she has on WLMOJ, nicoella keeps the profile usernames of her alts on the profile description of her other alts. Thus, this creates a huge chain of users that can easily help nicoella remember which accounts she own and the "special" passwords she has for every single account. However, while saving the profile descriptions, some of them glitched and they no longer have a username on them! The chain has been broken! However, now that she looks through everything, she realizes that her accounts used to form a tree. Given \(N\) total accounts and \(M\) connections between the accounts, find the number of accounts that nicoella needs to write usernames on to re-create the tree.

A tree is defined as a connected graph with one simple path between any pair of vertices, or in this case, one connection between any two of nicoella's alts.

Input Specification

The first line will contain an integer \(N\) \((2 \leq N \leq 100)\), the number of alts that nicoella has in total, and also an integer \(M\) \((0 \leq M \leq N-1)\), the number of alts that are still connected.

Output Specification

One integer, the number of alts that nicoella needs to connect to form the original tree.

Sample Input 1

2 1

Sample Output 1

0

Sample Input 2

6 3

Sample Output 2

2

Comments

There are no comments at the moment.