This summer vacation, FZU-ACM members get together for training in the name of dream. Some of them like fishing. One afternoon M members of them go fishing together around the lake, they bring many buckets with them and put their fish in either one of N buckets, they can only remember the number of fish they catch, and the number of fish in every bucket. When the sun went down, everyone wants to take away the part belonging to him, so they need to split the N buckets into more buckets (here we can assume the number of buckets they own is unlimited). They want to minimize the times of split. They are so tired, so ask you to help them solve their puzzle. Each time they can only split the fish in one bucket into two buckets.