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 aiaiis 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
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
有题目可以看出数量很小,但是想的太复杂了,自己写好长都过不了,看了别人的才发现可以暴力枚举,好气。菜的一匹。
这个题只要暴力枚举天数就好了,代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const ll maxn=1e7+10;
ll n,m;
ll a[110];
int main(){
ios::sync_with_stdio(false);
while(cin>>n>>m){
ll x;
memset(a,0,sizeof(a));
for(ll i=0;i<m;i++){
cin>>x;
a[x]++;
}
ll num;
ll ans = 0;
for(ll i=1;i<=100;i++){
num = 0;
for(ll j=0;j<110;j++){
num+=(a[j]/i);
}
if(num>=n){
ans = max(ans,i);
}
}
cout<<ans<<endl;
}
return 0;
}