Description

Natasha is planning an expedition to Mars for nn people. One of the important tasks is to provide food for each participant.

The warehouse has m daily food packages. Each package has some food type aiai.

Each participant must eat exactly one food package each day. Due to extreme loads, each participant must eat the same food type throughout the expedition. Different participants may eat different (or the same) types of food.

Formally, for each participant j Natasha should select his food type bjbj and each day j-th participant will eat one food package of type bj. The values bjbj for different participants may be different.

What is the maximum possible number of days the expedition can last, following the requirements above?

Input

The first line contains two integers nn and mm (1≤n≤100 1≤m≤100) — the number of the expedition participants and the number of the daily food packages available.

The second line contains sequence of integers a1,a2,…,am (1≤ai≤100), where aiai is the type of ii-th food package.

Output

Print the single integer — the number of days the expedition can last. If it is not possible to plan the expedition for even one day, print 0.

Sample Input

Input
4 10
1 5 2 1 1 1 2 5 7 2
Output
2
Input
100 1
1
Output
0
Input
2 5
5 4 3 2 1
Output
1
Input
3 9
42 42 42 42 42 42 42 42 42
Output
3

Hint

In the first example, Natasha can assign type 1 food to the first participant, the same type 11 to the second, type 55 to the third and type 22 to the fourth. In this case, the expedition can last for 2 days, since each participant can get two food packages of his food type (there will be used 44 packages of type 11, two packages of type 22 and two packages of type 55).

In the second example, there are 100100 participants and only 11 food package. In this case, the expedition can't last even 11 day.

题目意思:有n个人要去参加火星探险活动,准备了m份的食物,编号相同的属于一种食物,每个人每天都要吃一份食物并且必须一直吃一种食物,要是有人没有食物了就返回。问最后所有人一共可以存活多少天。

解题思路:使用map记录各种食物的个数,对能够存活的天数进行枚举暴力,使用迭代器对食物种类进行枚举,判断所有的食物能够支持的人数。

 #include<cstdio>
#include<cstring>
#include<map>
#include<algorithm>
using namespace std;
map<int,int>mp;
int main()
{
int n,m,i,j,ans,x,p,sum;
scanf("%d%d",&n,&m);
for(i=; i<=m; i++)
{
scanf("%d",&x);
mp[x]++;
}
if(m<n)
{
printf("0\n");
return ;
}
p=m/n;///能活下来的最大天数
map<int,int>::iterator it;
for(i=p; i>; i--) ///对存活的天数进行暴力
{
sum=;
for(it=mp.begin(); it!=mp.end(); it++)///对口粮种类进行暴力
{
sum+=it->second/i;
}
if(sum>=n)///判断最多能支持多少人
{
break;
}
}
printf("%d\n",i);
return ;
}
04-25 06:38