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 mm 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 jj Natasha should select his food type bjbj and each day jj-th participant will eat one food package of type bjbj. 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≤1001≤n≤100, 1≤m≤1001≤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,…,ama1,a2,…,am (1≤ai≤1001≤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.
Examples
input
Copy
4 10 1 5 2 1 1 1 2 5 7 2
output
Copy
2
input
Copy
100 1 1
output
Copy
0
//思想就是枚举每一天,把各种数量的事物分成sum份,若sum>=n表示这一天可以撑到,否则就不会撑到这天。
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,x,num[1000]={0};
cin>>n>>m;
for(int i=1;i<=m;i++)
{
cin>>x;
num[x]++;//记录每一份总数
}
if(n>m)
{
cout<<"0";
return 0;//如果m小于n肯定是0
}int i,j,ans=0;
for(i=1;i<=100;i++)
{
int sum=0;//枚举每一天;
for(j=1;j<=100;j++)
{
sum+=num[j]/i;
}
if(sum>=n)
{
ans=i;
}
else
{
break;
}
}
cout<<ans;
}