Natasha is planning an expedition to Mars for $n$ 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 $a_i$.

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 $b_j$ and each day $j$-th participant will eat one food package of type $b_j$. The values $b_j$ 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 $n$ and $m$ ($1 \le n \le 100$, $1 \le m \le 100$) — the number of the expedition participants and the number of the daily food packages available.

The second line contains sequence of integers $a_1, a_2, \dots, a_m$ ($1 \le a_i \le 100$), where $a_i$ is the type of $i$-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



-----Note-----

In the first example, Natasha can assign type $1$ food to the first participant, the same type $1$ to the second, type $5$ to the third and type $2$ 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 $4$ packages of type $1$, two packages of type $2$ and two packages of type $5$).

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

Source: codeforces | Difficulty: EASY
Tags: Sorting

Implementation

Complete search


Solutions:
(n, k) = map(int, input().split())
f = {}
for t in map(int, input().split()):
	if t in f:
		f[t] += 1
	else:
		f[t] = 1
f = list(f.values())
a = max(f)
while a > 0:
	if sum([x // a for x in f]) >= n:
		print(a)
		exit()
	else:
		a -= 1
print(a)


(n, m) = map(int, input().split())
provision = []
freq_dict = {}
for suit in map(int, input().split()):
	freq_dict[suit] = freq_dict.get(suit, 0) + 1
for suit in freq_dict:
	provision.append(freq_dict[suit])
provision.sort(reverse=True)
max_term = m // n
full_people = n
i = max_term
while i > 0 and full_people > 0:
	full_people = n
	for food in provision:
		full_people -= food // i
	i -= 1
if full_people <= 0:
	print(i + 1)
else:
	print(0)


import itertools
(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
f = [a.count(f) for f in range(1, 101)]
f.sort(reverse=True)
f = f[0:f.index(0)]
for d in range(f[0], -1, -1):
	if d == 0:
		print(d)
		break
	tkwf = 0
	for kt in f:
		tkwf += kt // d
	if tkwf >= n:
		print(d)
		break


(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
a = list(map(int, input().strip().split(' ')))
list.sort(a)
from itertools import groupby
g = [len(list(group)) for (key, group) in groupby(a)]
mx = -1
list.sort(g)
for i in range(1, 101):
	day = 0
	for j in range(len(g)):
		day = day + int(g[j] / i)
	if n <= day:
		mx = max(mx, i)
if mx > 0:
	print(mx)
else:
	print('0')


from collections import Counter
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
C = Counter(a)

def check(p):
	return sum((el // p for el in list(C.values()))) >= n

def binSearch(a, b):
	(left, right) = (a - 1, b + 1)
	while right - left > 1:
		mid = (left + right) // 2
		if check(mid):
			left = mid
		else:
			right = mid
	return left
print(binSearch(1, 100))


(k, n) = map(int, input().split())
b = list(map(int, input().split()))
m = []
c = 0
for i in range(102):
	m.append(0)
for i in b:
	m[i] += 1
l = 0
r = 101

def can(w):
	c = 0
	if max(m) // k >= w:
		return 1
	for i in range(len(m)):
		if m[i] >= w:
			c += m[i] // w
	if c >= k:
		return 1
	else:
		return 0
while r > l:
	w = (l + r) // 2
	if can(w):
		l = w + 1
	else:
		r = w
print(r - 1)


(*a,) = map(int, input().split())
(*str,) = map(int, input().split())
(n, m, b) = (a[0], a[1], [0] * 101)
for i in range(m):
	b[str[i]] += 1
ans = 0
for i in range(1, 101):
	sum = 0
	for j in range(1, 101):
		sum += int(b[j] / i)
	if sum >= n:
		ans = i
	if sum == 0:
		break
print(ans)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
val = [0 for i in range(105)]
for i in s:
	val[i] += 1

def check(day):
	ak = 0
	for i in val:
		ak += i // day
	if ak >= n:
		return 1
	else:
		return 0
ans = 1
if check(ans):
	while check(ans) == 1:
		ans += 1
	print(ans - 1)
else:
	print('0')


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
food = [0] * 100
for i in a:
	food[i - 1] += 1
max_amount = 0
for i in range(1, m + 1):
	sub_food = food.copy()
	sub_n = n
	for j in range(100):
		while sub_food[j] >= i and sub_n > 0:
			sub_food[j] -= i
			sub_n -= 1
		if sub_n == 0:
			break
	if sub_n == 0:
		max_amount = i
print(max_amount)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
c = dict()
for i in a:
	if i in c:
		c[i] += 1
	else:
		c[i] = 1
c = sorted(list(c.values()))

def check(p):
	d = c[:]
	for _ in range(n):
		while d and d[-1] < p:
			del d[-1]
		if not d:
			return False
		d[-1] -= p
	return True
for k in range(m, -1, -1):
	if check(k):
		print(k)
		break
else:
	print(0)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
l = 0
r = 1000
while l < r - 1:
	cur = (l + r) // 2
	counts = [0] * 101
	for el in arr:
		counts[el] += 1
	res = 1
	for i in range(n):
		ab = 0
		for j in range(101):
			if counts[j] >= cur and ab == 0:
				counts[j] -= cur
				ab = 1
				break
		if ab == 0:
			res = 0
	if res == 0:
		r = cur
	else:
		l = cur
print(l)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
l = []
y = [0]
for i in range(m):
	if i == 0:
		l.append(1)
		continue
	if a[i] == a[i - 1]:
		l[-1] += 1
	else:
		l.append(1)
for i in range(1, 101):
	z = 0
	lcopy = l.copy()
	for k in range(len(lcopy)):
		while lcopy[k] - i >= 0:
			lcopy[k] -= i
			z += 1
	if z >= n:
		y.append(i)
	else:
		break
print(y[-1])


def main():
	(n, m) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	count = [0] * 101
	for i in a:
		count[i] += 1
	b = [(count[i], i) for i in range(1, 101) if count[i]]
	b.sort(reverse=True)
	b = b[:n]
	flag = 0
	for i in b:
		flag += i[0]
	if m < n or flag < n:
		print(0)
	else:
		for day in range(1, 102):
			people = 0
			for (food, foodtype) in b:
				people += food // day
			if people < n:
				break
		print(day - 1)
main()


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
from collections import Counter
(n, m) = minput()
a = linput()
c = Counter(a)
for d in range(101, 0, -1):
	temp = 0
	for e in c:
		temp += c[e] // d
	if temp >= n:
		print(d)
		break
else:
	print(0)


from sys import stdin, stdout
import sys
(N, M) = [int(x) for x in input().split(' ')]
sk = [0] * 101
for x in stdin.readline().split():
	sk[int(x)] += 1
for i in range(M // N + 1, 0, -1):
	count = 0
	for j in range(101):
		count += sk[j] // i
	if count >= N:
		print(i)
		exit(0)
print(0)


(n, m) = map(int, input().split())
div = m // n
a = [int(x) for x in input().split()]
b = {}
c = []
d = 0
for x in a:
	if x not in b:
		b[x] = 1
	else:
		b[x] += 1
for (key, value) in b.items():
	c.append(value)
c.sort(reverse=True)
temp = 0
if len(c) > n:
	print(c[n - 1])
else:
	while div > 0:
		temp = 0
		for x in c:
			temp += x // div
		if temp >= n:
			break
		else:
			div -= 1
	print(div)


amount = list(map(int, input().split(' ')[:2]))
complects = list(map(int, input().split(' ')[:amount[1]]))
complects.sort()
comp = list()
for i in range(len(complects)):
	if i == 0:
		comp.append(1)
	elif complects[i] != complects[i - 1]:
		comp.append(1)
	else:
		comp[len(comp) - 1] += 1
comp.sort()
comp = list(reversed(comp))
compPair = list()
for i in range(amount[0]):
	if i < len(comp):
		compPair.append([comp[i], i])
	else:
		compPair.append([0, i])
compPair.sort()
success = False
while True:
	success = False
	before = compPair[0][0]
	for i in range(len(compPair) - 1, 0, -1):
		if compPair[i][1] == compPair[0][1] and compPair[i][0] - 1 >= compPair[0][0] + 1:
			compPair[i][0] -= 1
			compPair[0][0] += 1
			success = True
			break
	if success == False:
		for i in range(len(compPair) - 1, 0, -1):
			if compPair[i][0] - compPair[0][0] - 1 > compPair[0][0]:
				for j in range(len(compPair) - 1, 0, -1):
					if compPair[i][1] == compPair[0][1]:
						compPair[i][0] += compPair[0][0]
						break
				compPair[i][0] -= compPair[0][0] + 1
				compPair[0][0] += 1
				compPair[0][1] = compPair[i][1]
				break
	if before == compPair[0][0]:
		break
	compPair.sort()
print(compPair[0][0])


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
listik = []
numbers = []
for i in l:
	if i in numbers:
		pass
	else:
		listik.append(l.count(i))
		numbers.append(i)
listik.sort()
maximum = 0
x = False
for i in range(1, max(listik) + 1):
	counter = 0
	for j in listik[::-1]:
		if j // i > 0:
			counter += j // i
		elif counter >= n:
			x = True
			break
	if counter >= n:
		if maximum < i:
			maximum = i
print(maximum)


def check(t):
	x = 0
	for elem in cnt:
		x += elem // t
	return x >= n
(n, m) = map(int, input().split())
cnt = [0] * 100
arr = list(map(int, input().split()))
for i in range(m):
	x = arr[i]
	cnt[x - 1] += 1
L = 0
R = 101
while R - L > 1:
	M = (L + R) // 2
	if check(M):
		L = M
	else:
		R = M
print(L)


from collections import Counter
(npar, npack) = map(int, input().split())
pack_arr = list(map(int, input().split()))
if npar > npack:
	print(0)
elif npack // npar == 1:
	print(1)
else:
	occurences = Counter(pack_arr)
	longest_days = 1
	for days in range(2, npack // npar + 1):
		current_ful = 0
		for k in occurences:
			current_ful += occurences[k] // days
			if current_ful >= npar:
				longest_days = days
				break
		else:
			break
	print(longest_days)


import math as ma
from sys import exit
from decimal import Decimal as dec

def li():
	return list(map(int, input().split()))

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
(n, m) = num()
a = li()
f = [0] * 101
for i in range(m):
	f[a[i]] += 1
l = 0
r = 101
ff = 0
for j in range(1, 101):
	pp = 0
	for i in range(101):
		pp += f[i] // j
	if pp >= n:
		ff = max(j, ff)
print(ff)


import sys
(n, m) = list(map(int, input().split()))
q = []
c = []
for i in range(101):
	q.append(0)
a = list(map(int, input().split()))
for i in range(m):
	q[a[i]] += 1
for i in range(100):
	d = 100 - i
	k = 0
	for j in range(100):
		if q[j + 1] >= d:
			k += q[j + 1] // d
	if k >= n:
		print(d)
		exit()
print(0)


import math
import copy
(n, m) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
mas = [0] * 101
ans = 0
flag = True
for i in range(m):
	mas[a[i]] += 1
for d in range(m, 0, -1):
	k = 0
	for i in range(101):
		k += math.floor(mas[i] / d)
	if k >= n and k >= ans:
		print(d)
		flag = False
		break
if flag:
	print(0)


from collections import Counter
(n, m) = list(map(int, input().split()))
b = Counter(map(int, input().split()))
res = 0
for days in range(1, m // n + 1):
	parts = 0
	for j in b.values():
		parts += j // days
	if parts >= n:
		res = days
print(res)


from collections import Counter
(n, k) = map(int, input().split(' '))
l = [int(c) for c in input().split(' ')]
d = list(Counter(l).values())
if k < n:
	print(0)
else:
	m = k // n
	p = 0
	for i in range(1, m + 1):
		s = 0
		for j in d:
			s += j // i
		if s >= n:
			p = i
		else:
			break
	print(p)


from collections import Counter
param = input().split()
food_types = list(Counter(input().split()).values())
days = 1
people = int(param[0])
people_fed = sum(food_types)
while people_fed >= people:
	days += 1
	people_fed = 0
	for food in food_types:
		people_fed += food // days
print(days - 1)


def f(n, order, i):
	num = 0
	for c in order:
		num += int(c / i)
	if num >= n:
		return True
	return False
(n, m) = map(int, input().split(' '))
inputs = list(map(int, input().split(' ')))
l = [0] * 100
for i in inputs:
	l[i - 1] += 1
order = []
for i in range(100):
	if l[i] != 0:
		order.append(l[i])
best = 0
minn = 1
maxx = sum(order) + 1
while minn != maxx:
	middle = int((minn + maxx) / 2)
	if f(n, order, middle):
		best = middle
		minn = middle + 1
	else:
		maxx = middle
print(int(best))


[n, m] = map(int, input().split())
data = list(map(int, input().split()))
cnt = [0] * 120
for i in data:
	cnt[i] += 1
ans = 0
i = 1
while True:
	ans = 0
	for j in cnt:
		ans += j // i
	if ans < n:
		print(i - 1)
		break
	i += 1


from collections import Counter
(n, m) = list(map(int, input().split()))
packets = list(map(int, input().split()))
packets = dict(Counter(packets))
val = packets.values()
i = 1
while True:
	sum = 0
	for j in val:
		sum += int(j / i)
	if sum < n:
		break
	i += 1
print(i - 1)


(n, m) = map(int, input().split())
book1 = [int(x) for x in input().split()]
book2 = set(book1)
book3 = list(book2)
num = []
for i in range(len(book3)):
	num.append(book1.count(book3[i]))
if m < n:
	print(0)
elif m == n:
	print(1)
else:
	day = m // n
	while day:
		people = 0
		for i in range(len(num)):
			people += num[i] // day
		if people >= n:
			break
		else:
			day = day - 1
	print(day)


(n, m) = list(map(int, input().split()))
N = list(map(int, input().split()))
A = [0] * 100
for i in range(m):
	A[N[i] - 1] += 1
X = [0] * 100
f = 0
r = 100000
g = 0
for i in range(n):
	f = 0
	for k in range(100):
		if A[k] // (X[k] + 1) > f:
			f = A[k] // (X[k] + 1)
			g = k
	X[g] += 1
	r = min(r, A[g] // X[g])
print(r)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
mp = {}
for i in a:
	if i in mp:
		mp[i] += 1
	else:
		mp[i] = 1
for ans in range(10000, -1, -1):
	tmp = 0
	if ans == 0:
		print(ans)
		break
	for i in mp.values():
		tmp += i // ans
	if tmp >= n:
		print(ans)
		break


from collections import Counter
(n, m) = list(map(int, input().split()))
a = [int(i) for i in input().split()]
d = dict(Counter(a)).values()
k = 1
while sum((i // k for i in d)) >= n:
	k += 1
print(k - 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for chr in a:
	if chr not in d:
		d[chr] = 1
	else:
		d[chr] += 1
p = list(d.values())
z = k // n
if z == 0:
	print(0)
else:
	o = []
	if len(a) >= n:
		o.append(1)
	for i in range(2, z + 1):
		c = 0
		for j in range(len(p)):
			c += p[j] // i
		if c >= n:
			o.append(i)
	print(max(o))


def check(k, z, n):
	if k == 0:
		print(k)
		return
	counter = 0
	for i in z:
		counter += int(z[i] / k)
	if counter >= n:
		print(k)
		return
	else:
		k = k - 1
		check(k, z, n)
(n, m) = map(int, input().split())
from collections import Counter
qlist = map(int, input().split())
z = Counter(qlist)
k = int(m / n)
check(k, z, n)


import sys
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
d = {}
d = d.fromkeys(l, 0)
for i in l:
	d[i] = d.get(i) + 1
x = list(d.values())
x.sort()
k = 1
u = 0
while k:
	if sum(x) < n:
		print(0)
		u = 0
		break
	newList = [int(t / k) for t in x]
	if sum(newList) < n:
		u = 1
		break
	else:
		k = k + 1
if u:
	print(k - 1)


import collections
(n, m) = map(int, input().split())
t = collections.Counter(input().split())
left = 0
right = 1000
while left + 1 < right:
	mid = left + (right - left) // 2
	if sum([k // mid for k in t.values()]) < n:
		right = mid
	else:
		left = mid
print(left)


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
na = [0] * 101
a.sort()
f = 0
for i in range(m):
	na[a[i]] += 1
for i in range(100, 0, -1):
	k = 0
	nna = []
	for x in range(len(na)):
		nna.append(na[x])
	for j in range(1, 101):
		while nna[j] >= i:
			k += 1
			nna[j] -= i
	if k >= n:
		print(i)
		f = 1
		break
if f == 0:
	print(0)


import sys
import os

def test(food, n, day):
	p = 0
	for i in food:
		p += i // day
	return p >= n

def solve(package, n):
	food = dict()
	for f in package:
		if f in food:
			food[f] += 1
		else:
			food[f] = 1
	r = list(food.values())
	left = 0
	right = 1000
	while right > left + 1:
		mid = (left + right) // 2
		if test(r, n, mid):
			left = mid
		else:
			right = mid
	return left

def main():
	(n, m) = map(int, input().split())
	package = list(map(int, input().split()))
	print(solve(package, n))

def __starting_point():
	main()
__starting_point()


from collections import Counter
(n, m) = map(int, input().split())
c = Counter(input().split())
c = tuple(c.values())
for d in range(1, 102):
	if sum(map(lambda x: x // d, c)) < n:
		print(d - 1)
		break


from collections import Counter
(pessoas, pacotes) = map(int, input().split())
comidas = map(int, input().split())
vetor = list(Counter(comidas).values())
dias = pacotes // pessoas
while dias > 0:
	if sum([comida // dias for comida in vetor]) >= pessoas:
		break
	dias -= 1
print(dias)


def funca(mean, a, h):
	if mean == 0:
		print('0')
		return 0
	s = 0
	for f in a:
		s += int(f / mean)
	if s >= h:
		print(mean)
		return 0
	else:
		mean -= 1
		funca(mean, a, h)
inp = input().split()
h = int(inp[0])
e = int(inp[1])
mean = int(e / h) + 1
a = [int(f) for f in input().split()]
b = set(a)
c = {f: 0 for f in range(1, max(a) + 1)}
for f in b:
	for g in a:
		if f == g:
			c[f] += 1
colvo = []
for (f, g) in c.items():
	colvo.append(int(g))
funca(mean, colvo, h)


import heapq
(numPeople, numPackages) = input().split(' ')
packages = input().split(' ')
packs = {}
for p in packages:
	if p not in packs:
		packs[p] = 1
	else:
		packs[p] += 1
ps = [(-v, 0, v) for (k, v) in packs.items()]
heapq.heapify(ps)
for i in range(0, int(numPeople)):
	top = heapq.heappop(ps)
	next_elem = (-(top[2] // (top[1] + 2)), top[1] + 1, top[2])
	heapq.heappush(ps, next_elem)
print(min([p[2] // p[1] for p in filter(lambda x: x[1] > 0, ps)]))


from copy import copy
MAX_N = 100
(n, m) = map(int, input().strip().split())
a = [int(x) for x in input().strip().split()]
d = [0 for x in range(MAX_N + 1)]
tot = 0
for x in a:
	d[x] += 1
	tot = max(d[x], tot)
m = 0
solved = False
for x in range(tot, 0, -1):
	dd = copy(d)
	cnt = 0
	for i in range(1, MAX_N + 1):
		while dd[i] >= x:
			dd[i] -= x
			cnt += 1
		if cnt >= n:
			print(x)
			solved = True
			break
	if solved:
		break
if not solved:
	print(0)


from collections import Counter
(n, m) = map(int, input().split())
tab = list(map(int, input().split()))
tab = Counter(tab).values()
wynik = 1
while sum((paczka // wynik for paczka in tab)) >= n:
	wynik += 1
print(wynik - 1)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
rec = {}
for i in range(m):
	rec[a[i]] = rec.get(a[i], 0) + 1
r = 1
while True:
	q = 0
	for i in rec.values():
		q += i // r
	if q < n:
		break
	r += 1
print(r - 1)


from collections import Counter
(n, m) = list(map(int, input().split()))
f = list(map(int, input().split()))
c = dict(Counter(f))
d = 1
ans = 0
while d:
	t = 0
	for i in c.values():
		t += i // d
	if t >= n:
		ans = d
	else:
		break
	d += 1
print(ans)


gi = lambda : list(map(int, input().split()))
(n, m) = gi()
l = [0] * 101
for e in gi():
	l[e] += 1
k = 1
while sum([e // k for e in l]) >= n:
	k += 1
print(k - 1)


from collections import defaultdict as dd
d = dd(int)
(n, k) = [int(i) for i in input().split(' ')]
l = [int(i) for i in input().split(' ')]
for i in l:
	d[i] += 1
m = sorted(d.values())
if sum(l) < n:
	print(0)
else:
	ans = 0
	for x in range(1, 10000):
		p = 0
		for i in m:
			p += i // x
		if p >= n:
			ans = x
	print(ans)


def main():
	(n, m) = map(int, input().split())
	storage = [0] * 101
	for i in map(int, input().split()):
		storage[i] += 1
	storage = [i for i in storage if i != 0]
	num_of_days = 1
	while True:
		if max_people(storage, num_of_days) < n:
			print(num_of_days - 1)
			return 0
		num_of_days += 1

def max_people(storage, num_of_days):
	result = 0
	for i in storage:
		result += int(i / num_of_days)
	return int(result)
main()


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
if m >= n:
	b = []
	for item in set(a):
		b.append(a.count(item))
	if len(b) == 1:
		print(b[0] // n)
	else:
		x = sorted(b, reverse=True)[n - 1] if len(b) >= n else 0
		while len(b) < n:
			b.sort()
			b.append(b[-1] // 2)
			b[-2] = b[-2] // 2 + b[-2] % 2
		b.sort()
		while b[-1] // 2 > b[0]:
			b[0] = b[-1] // 2
			b[-1] = b[-1] // 2 + b[-1] % 2
			b.sort()
		print(max(b[0], x))
else:
	print(0)


from collections import Counter
(n, m) = list(map(int, input().split()))
a = input().split()
c = Counter(a)
freqs = []
for i in c.keys():
	freqs.append(c[i])
freqs.sort(reverse=True)
for days in range(100, 0, -1):
	done = 0
	for i in freqs:
		done += i // days
	if done >= n:
		print(days)
		break
else:
	print(0)


(n, k) = map(int, input().split())
s = {}
a = list(map(int, input().split()))
d = 102 * [0]
b = 0
for t in range(k):
	d[a[t]] += 1
	s[a[t]] = d[a[t]]
s = list(s.values())
s.sort()
s.reverse()
m = max(s)
for t in range(m):
	x = m - t
	l = m // x
	p = l
	for i in s[1:]:
		p += i // x
	if p >= n:
		b = 1
		print(x)
		break
if b == 0:
	print(0)


from bisect import bisect
from collections import defaultdict
from math import gcd, sqrt, ceil, inf
from collections import Counter
import sys
sys.setrecursionlimit(1000000)
from bisect import bisect
from collections import defaultdict
from math import gcd, sqrt, ceil, inf
from collections import Counter
import sys
sys.setrecursionlimit(10 ** 9)
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
hash = defaultdict(int)
for i in l:
	hash[i] += 1
for i in range(1000, 0, -1):
	ans = i * n
	sum = 0
	for j in hash:
		sum += hash[j] // i
	if sum >= n:
		print(i)
		exit()
print(0)


(a, b) = map(int, input().split())
l = sorted(list(map(int, input().split())))
m = set()
for i in l:
	m.add(i)
k = {}
for i in m:
	k[i] = l.count(i)
c = 0
for i in range(1, 101):
	y = 0
	for j in k:
		y += k[j] // i
	if y >= a:
		c += 1
	else:
		break
print(c)


from collections import Counter
(nop, nopkt) = [int(x) for x in input().split()]
packets = Counter([int(x) for x in input().split()]).values()
days = 1
while sum((x // days for x in packets)) >= nop:
	days += 1
print(days - 1)


(n, m) = map(int, input().split())
K = list(map(int, input().split()))
D = dict()
for i in range(m):
	if K[i] in D.keys():
		D[K[i]] += 1
	else:
		D[K[i]] = 1
ans = 0
for days in range(1, 102):
	h = 0
	for i in D.values():
		h += i // days
	if h >= n:
		ans = days
	else:
		break
print(ans)


mod = 10 ** 9 + 7
import math
for _ in range(1):
	(n, m) = map(int, input().split())
	pk = list(map(int, input().split()))
	li = [0 for i in range(101)]
	for i in pk:
		li[i] += 1
	ans = 0
	for i in range(1, 501):
		k = li.copy()
		p = 0
		ind = 0
		while ind < 101 and p < n:
			p += k[ind] // i
			ind += 1
		if p >= n:
			ans = i
	print(ans)


def f(s):
	k = 0
	for el in b.values():
		k += el // s
	if k >= n:
		return True
	else:
		return False
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = {}
for i in a:
	b[i] = b.get(i, 0) + 1
l = 0
r = 100000
while r - l > 1:
	m = (l + r) // 2
	if f(m):
		l = m
	else:
		r = m
if not f(1):
	print(0)
else:
	print(l)


from collections import *
(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
cnt = Counter(a)
(lo, hi) = (0, m)
while lo < hi:
	mid = (lo + hi + 1) // 2
	total = 0
	for (val, supply) in cnt.items():
		total += supply // mid
	if total >= n:
		lo = mid
	else:
		hi = mid - 1
print(lo)


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [0] * 101
for x in range(m):
	b[a[x]] += 1
b.sort(reverse=True)
for x in range(101, 0, -1):
	temp = 0
	for y in range(len(b)):
		temp += b[y] // x
	if temp >= n:
		print(x)
		exit(0)
print(0)


import sys
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
b = [1]
for i in range(1, len(a)):
	if a[i] == a[i - 1]:
		b[-1] += 1
	else:
		b.append(1)
b.sort(reverse=True)
kol = 0
flag = True
for i in range(100, 0, -1):
	for j in range(len(b)):
		kol += b[j] // i
	if kol >= n:
		print(i)
		flag = False
		break
	kol = 0
if flag:
	print(0)


from collections import Counter
(n, m) = map(int, input().split())
foods = list(map(int, input().split()))
c = Counter(foods)
foods = [*c.values()]
res = 1
d = sum(foods)
while d >= n:
	d = 0
	res += 1
	for i in range(len(foods)):
		d += foods[i] // res
print(res - 1)


(n, m) = list(input().split())
(n, m) = [int(n), int(m)]
ls = list(map(int, list(input().split())))
dic = {i: 0 for i in range(1, 101)}
for i in ls:
	dic[i] += 1
days = 0
for i in range(1, 1000):
	temp_m = n
	for j in dic.values():
		if temp_m <= 0:
			break
		if j >= i:
			temp_m = temp_m - j // i
	if temp_m <= 0:
		days = i
	else:
		break
print(days)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = dict()
for i in a:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
x = []
for j in d:
	x.append(d[j])
x.sort(reverse=True)

def f(t):
	ans = 0
	for i in x:
		ans += i // t
	if ans >= n:
		return True
	return False
left = 0
right = 10 ** 9
while left + 1 != right:
	mid = (left + right) // 2
	if f(mid):
		left = mid
	else:
		right = mid
print(left)


from collections import Counter

def solve(participants_count, packages):
	day = 1
	while sum((value // day for value in packages.values())) >= participants_count:
		day += 1
	return day - 1
(participants, _) = map(int, input().split())
packages = Counter(input().split())
print(solve(participants, packages))


from collections import Counter

def can_we_give(freq, packets, n):
	fullfilled = 0
	for food_packets in freq.keys():
		fullfilled += freq[food_packets] // packets
	if fullfilled >= n:
		return True
	else:
		return False

def main():
	(n, m) = (int(num) for num in input().split())
	A = [int(num) for num in input().split()]
	if m < n:
		return 0
	else:
		freq = Counter(A)
		(l, r) = (1, max(freq.values()) + 1)
		while l + 1 < r:
			mid = (l + r) // 2
			if can_we_give(freq, mid, n):
				l = mid
			else:
				r = mid
		return l
output = main()
print(output)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = [0 for _ in range(101)]
for ai in a:
	cnt[ai] += 1
l = 0
r = 101
while l + 1 < r:
	c = (l + r) // 2
	k = 0
	for i in range(1, 101):
		k += cnt[i] // c
	if n <= k:
		l = c
	else:
		r = c
print(l)


from collections import Counter
(n, m) = map(int, input().split())
a = map(int, input().split())
a = Counter(a).values()
ret = 0
for i in range(1, max(a) + 1):
	cnt = sum([x // i for x in a])
	if cnt >= n:
		ret = i
print(ret)


(n, m) = [int(x) for x in input().split(' ')]
z = [int(x) for x in input().split(' ')]
d = {}
for x in z:
	if x in d.keys():
		d[x] += 1
	else:
		d[x] = 1
(s, ans, days, a) = (0, 0, 0, 10000000)
l = list(d.values())
l.sort()
l.reverse()
for x in l:
	s += x
	a = min(s // n, x)
	ans = max(ans, a)
if ans == 0:
	print(ans)
else:
	for x in l:
		days += x // ans
	if days >= n:
		print(ans)
	else:
		ans -= 1
		days = 0
		for x in l:
			days += x // ans
		if days >= n:
			print(ans)
		else:
			print(ans - 2)


from collections import defaultdict
(n, m) = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
food = [0 for i in range(101)]
users = [0 for i in range(101)]
for i in x:
	food[i] += 1
days = 1000
for i in range(n):
	best = 0
	cand = -1
	for j in range(101):
		if food[j] // (users[j] + 1) > best:
			best = food[j] // (users[j] + 1)
			cand = j
	users[cand] += 1
	days = min(days, best)
print(days)


(n, m) = (int(x) for x in input().split())
a = [int(x) for x in input().split()]
d = {}
if n > m:
	print(0)
else:
	big = 0
	for i in a:
		if i in d:
			continue
		else:
			d[i] = a.count(i)
			big = max(d[i], big)
	ans = 0
	for i in range(1, big + 1):
		c = 0
		for j in d.keys():
			if d[j] >= i:
				c += d[j] // i
		if c >= n:
			ans = max(ans, i)
		else:
			break
	print(ans)


(n, m) = map(int, input().split())
packages = list(map(int, input().split()))
counts = dict()
for p in packages:
	if p in counts:
		counts[p] += 1
	else:
		counts[p] = 1
arrayCounts = []
for (package, count) in counts.items():
	arrayCounts.append(count)
arrayCounts.sort()
arrayCounts.reverse()
for i in range(m // n + 1):
	days = i + 1
	people = 0
	for type in arrayCounts:
		people += type // days
	if people < n:
		break
print(i)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in range(m):
	if a[i] not in d:
		d[a[i]] = 1
	else:
		d[a[i]] += 1
ans = 0
for i in range(1, 101):
	p = 0
	for j in d.values():
		p += j // i
	if p >= n:
		ans = i
print(ans)


(n, m) = [*map(int, input().split())]
li = [*map(int, input().split())]
from collections import Counter
c = Counter(li)
if n > m:
	print(0)
	quit()
day = 1
add = 0
for i in c:
	add += c[i] // day
while add >= n:
	add = 0
	day += 1
	for i in c:
		add += c[i] // day
print(day - 1)


import operator
(p, f) = map(int, input().split())
foods = list(map(int, input().split()))
fc = {}
for i in foods:
	if i not in fc:
		fc[i] = foods.count(i)
foods = set(foods)
counts = {}
for i in foods:
	counts[i] = 0
maxDays = {}
for i in foods:
	maxDays[i] = fc[i]
for i in range(p):
	key = max(maxDays.items(), key=operator.itemgetter(1))[0]
	counts[key] += 1
	maxDays[key] = int(fc[key] / (counts[key] + 1))
for i in list(foods):
	if counts[i] == 0:
		foods.remove(i)
print(min([int(fc[i] / counts[i]) for i in foods]))


(n, m) = map(int, input().split())
cnt = [0] * 100
arr = list(map(int, input().split()))
for i in range(m):
	x = arr[i]
	cnt[x - 1] += 1
for t in range(1, 102):
	x = 0
	for elem in cnt:
		x += elem // t
	if x < n:
		print(t - 1)
		break


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
x = []
for i in d:
	x.append(d[i])
k = m // n
ans = 0
while k > 0:
	p = 0
	e = x[:]
	for i in range(len(x)):
		while e[i] >= k:
			p += 1
			e[i] -= k
	if p >= n:
		ans = k
		break
	k -= 1
	if k <= 0:
		break
print(ans)


import math

def main():
	[n, m] = map(int, input().split(' '))
	if n > m:
		print(0)
	else:
		food = [int(x) for x in input().split(' ')]
		inventory = [food.count(x) for x in list(set(food))]
		burst = sum([1 - 1 / x for x in inventory])
		a = max(math.floor(m / (n + len(inventory))), 1)
		while sum([math.floor(x / a) for x in inventory]) >= n:
			a += 1
		print(a - 1)
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in a:
	try:
		d[i]
	except:
		d[i] = 1
	else:
		d[i] += 1
l = list(d.values())
l.sort()
md = 0
for i in range(m, 0, -1):
	a = l[:]
	for j in range(len(a)):
		a[j] = a[j] // i
	if sum(a) >= n:
		md = i
		break
print(md)


import collections as col
M = lambda : list(map(int, input().split()))
(n, m) = M()
a = M()
t = col.Counter(a).values()
w = 0
for e in range(1, 101):
	y = []
	for a in t:
		y.append(a // e)
	if sum(y) >= n:
		w = e
print(w)


import math

def sum():
	y = 0
	ych = 0
	for i in range(len(lc) - 1, -1, -1):
		ych += 1
		if ych > n:
			return y
		y += lc[i] // day
	return y
(n, k) = map(int, input().split())
l = list(map(int, input().split()))
if n > k:
	print(0)
else:
	l.sort()
	lc = []
	x = 1
	for i in range(0, k - 1):
		if l[i] == l[i + 1]:
			x += 1
		else:
			lc.append(x)
			x = 1
	if x != 1:
		lc.append(x)
	day = 2
	lc.sort()
	while sum() >= n:
		day += 1
	print(day - 1)


(n, m) = map(int, input().split())
temp = list(map(int, input().split()))
temp2 = set(temp)
a = {int(i): temp.count(i) for i in temp2}
res = 0
for i in range(1, m + 1):
	temp = n
	for j in a:
		temp -= a[j] // i
		if temp <= 0:
			res = i
			break
	else:
		break
print(res)


def is_enough(cnt, days_proposed, people_count):
	count = 0
	i = len(cnt) - 1
	while i >= 0 and cnt[i] > 0:
		count += cnt[i] // days_proposed
		i -= 1
	return count >= people_count

def get_days(a, n, m):
	cnt = [0] * 101
	for elem in a:
		cnt[elem] += 1
	cnt.sort()
	(left, right) = (0, m + 1)
	while left + 1 < right:
		days = (left + right) // 2
		if is_enough(cnt, days, n):
			left = days
		else:
			right = days
	return left
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
print(get_days(a, n, m))


(n, m) = list(map(int, input().split()))
a = [0] * 100
inp = list(map(int, input().split()))
for i in inp:
	a[i - 1] += 1
go = True
ans = 0
for i in range(1000):
	b = [i for i in a]
	cnt = 0
	for j in b:
		cnt += j // (i + 1)
	go = cnt >= n
	if not go:
		ans = i
		break
print(i)


(n, m) = map(int, input().split())
a = [int(el) for el in input().split()]
b = [0] * 101
for i in range(m):
	b[a[i]] += 1
d = []
for i in b:
	if i != 0:
		d.append([i, 0])

def f(df):
	return -df[0]
d.sort(key=f)
k = 0
l = 0
for i in range(n):
	nm = 0
	mm = d[0][0] // (d[0][1] + 1)
	for j in range(len(d)):
		if mm < d[j][0] // (d[j][1] + 1):
			nm = j
			mm = d[j][0] // (d[j][1] + 1)
	d[nm][1] += 1
print(mm)


from collections import Counter
(n, _) = map(int, input().split())
c = Counter(list(map(int, input().split())))
result = 0
res = 1
while True:
	result = 0
	for i in c.values():
		result += i // res
	if result < n:
		res -= 1
		break
	res += 1
print(res)


from collections import Counter
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
c = Counter(l)
l = [*c.values()]
l.sort()
k = 1
while sum((i // k for i in l)) >= n:
	k += 1
print(k - 1)


from collections import Counter
(n, m) = map(int, input().split())
if n > m:
	print(0)
	quit()
a = list(map(int, input().split()))
d = 1
c = Counter(a).values()
while True:
	s = sum([i // d for i in c])
	if s >= n:
		d += 1
	else:
		break
print(d - 1)


from collections import Counter
(n, m) = [int(x) for x in input().strip().split(' ', 1)]
a = [int(x) for x in input().strip().split(' ')]
s = Counter(a)
mx = int(m / n)
l = 1
r = mx
ans = 0

def ful(x):
	if sum((int(v / x) for v in s.values())) >= n:
		return True
	return False
while l <= r:
	mid = int((l + r) / 2)
	if ful(mid):
		ans = mid
		l = mid + 1
	else:
		r = mid - 1
print(ans)


from collections import defaultdict

def fun(mid):
	cnt = 0
	for x in arr_set:
		cnt += freq[x] // mid
	return cnt >= n
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
freq = defaultdict(int)
for x in arr:
	freq[x] += 1
arr_set = set(arr)
start = 1
end = m
ans = -1
while start <= end:
	mid = (start + end) // 2
	if fun(mid):
		ans = mid
		start = mid + 1
	else:
		end = mid - 1
if ans == -1:
	print(0)
else:
	print(ans)


def check(x):
	ans = 0
	for i in range(101):
		ans += cnt[i] // x
	return ans >= n
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
cnt = [0] * 101
for elem in a:
	cnt[elem] += 1
l = 0
r = m + 1
while r - l > 1:
	mid = (r + l) // 2
	if not check(mid):
		r = mid
	else:
		l = mid
print(l)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n, m) = I()
d = dd(int)
a = I()
for i in a:
	d[i] += 1
ans = 0
for i in range(1000, 0, -1):
	p = 0
	for j in d:
		p += d[j] // i
	if p >= n:
		ans = i
		break
print(ans)


(n, m) = list(map(int, input().split()))
a = {}
for i in list(map(int, input().split())):
	if i in a:
		a[i] += 1
	else:
		a[i] = 1
b = []
for i in a:
	b.append([a[i], 1])
b.sort()
for i in range(n):
	if b[-1][0] // b[-1][1] == 0:
		print(0)
		break
	b[-1][1] += 1
	b.sort(key=lambda x: x[0] // x[1])
else:
	ans = min(b, key=lambda x: x[0] // (x[1] - 1) if x[1] > 1 else 10 ** 5)
	print(ans[0] // (ans[1] - 1))


def f(p, k):
	if k == 0:
		return 0
	s = 0
	for i in p:
		s = s + i // k
	return s
(n, m) = [int(x) for x in input().split()]
packages = [int(x) for x in input().split()]
q = 101 * [0]
for i in packages:
	q[i] = q[i] + 1
q = sorted(q, reverse=True)
packages = []
for i in q:
	if i > 0:
		packages.append(i)
l = 1
r = m // n + 1
mid = 0
while l < r - 1:
	mid = (l + r) // 2
	if f(packages, mid) >= n:
		l = mid
	else:
		r = mid
if f(packages, r) >= n:
	print(r)
elif f(packages, mid) >= n:
	print(mid)
elif f(packages, l) >= n:
	print(l)
else:
	print('0')


(p, f) = [int(x) for x in input().split()]
(to, count) = (0, 0)
t = []
for tn in sorted([int(x) for x in input().split()]):
	if tn == to:
		count += 1
	else:
		t.append(count)
		count = 1
	to = tn
t.append(count)
d = 0
x = f // p
for i in range(x, 0, -1):
	if sum([y // i for y in t]) >= p:
		d = i
		break
print(d)


def solve(particpant, package, seq):
	maximumDays = package // particpant
	seq.sort()
	while maximumDays > 0:
		participantFed = 0
		type = seq[0]
		temp = 0
		for x in seq:
			if temp == maximumDays:
				participantFed += 1
				temp = 1
				type = x
			elif type == x:
				temp += 1
			else:
				type = x
				temp = 1
		if temp == maximumDays:
			participantFed += 1
		if participantFed >= particpant:
			return maximumDays
		maximumDays -= 1
	return maximumDays
(p, pa) = list(map(int, input().split()))
seq = list(map(int, input().split()))
print(solve(p, pa, seq))


vis = [0] * 105
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for i in a:
	vis[i] += 1
ans = 0
for i in range(1, m + 1):
	cnt = 0
	for j in range(1, 101):
		cnt += vis[j] // i
	if cnt >= n:
		ans = max(ans, i)
print(ans)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
mem = [0] * 101
for i in range(m):
	mem[arr[i]] += 1
if m < n:
	print('0')
elif m == n:
	print('1')
else:
	ans = 0
	for i in range(1, 101):
		j = 0
		sm = 0
		while j < 101:
			sm += mem[j] // i
			j += 1
		if sm >= n:
			ans = i
	print(ans)


(n, m) = map(int, input().split())
s = list(map(int, input().split()))
d = dict()
for i in s:
	try:
		d[i] += 1
	except:
		d.update({i: 1})
s1 = []
for i in d:
	s1.append(d[i])
s1.sort()
ans = 0
for i in range(1, 101):
	t = s1.copy()
	x = 0
	while len(t) > 0 and x != n:
		if t[-1] < i:
			t.pop()
		else:
			t[-1] -= i
			x += 1
	if x == n:
		ans = max(ans, i)
print(ans)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
dict1 = {}
for i in range(m):
	try:
		dict1[arr[i]] += 1
	except:
		KeyError
		dict1[arr[i]] = 1
arrx = []
for i in dict1:
	arrx.append(dict1[i])
arrx.sort(reverse=True)
ans = 0
if m < n:
	print(0)
else:
	for i in range(1, arrx[0] + 1):
		ans1 = 0
		for j in range(len(arrx)):
			ans1 += arrx[j] // i
		if ans1 >= n:
			ans = i
	print(ans)


(n, m) = map(int, input().split())
a = input().split()
ls = [0 for i in range(100)]
for i in range(m):
	ls[int(a[i]) - 1] += 1
a.sort(reverse=True)
ans = m // n
while ans:
	count = 0
	for i in range(100):
		count += ls[i] // ans
	if count >= n:
		break
	ans -= 1
print(max(ans, 0))


from collections import Counter
(x, n) = map(int, input().split())
frq = Counter(list(map(int, input().split())))
lo = 1
hi = n
ans = 0
while lo <= hi:
	mid = lo + (hi - lo) // 2
	rem = x
	for i in frq:
		rem -= frq[i] // mid
	if rem <= 0:
		ans = mid
		lo = mid + 1
	else:
		hi = mid - 1
print(ans)


(n, m) = map(int, input().split())
(a, a_sorted, d) = (sorted(list(map(int, input().split()))), [], int(m / n))
for i in range(len(set(a))):
	for j in range(a.count(list(set(a))[i])):
		a_sorted.append(list(set(a))[i])
while True:
	(i, x) = (0, 0)
	while x < n and i < len(a_sorted):
		if i + d <= len(a_sorted) and len(set(a_sorted[i:i + d])) == 1:
			i += d
			x += 1
		else:
			i += 1
	if x < n and d != 0:
		d -= 1
	else:
		break
print(d)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
z = {}
for i in l:
	if i in z:
		z[i] = z[i] + 1
	else:
		z[i] = 1
l = list(z.values())
l.sort(reverse=True)
for i in range(len(l)):
	if i > n:
		l.pop()
ans = []
f = []
noans = 0
for i in range(len(l)):
	ans.append(1)
	f.append(0)
while n > 0:
	maxi = 0
	for i in range(1, len(l)):
		if l[i] // ans[i] > l[maxi] // ans[maxi]:
			maxi = i
	ans[maxi] = ans[maxi] + 1
	if l[maxi] // (ans[maxi] - 1) == 0 and f[maxi] == 1:
		noans = 1
		break
	f[maxi] = 1
	n = n - 1
mini = 0
for i in range(len(l)):
	if f[i] == 1:
		if l[mini] / (ans[mini] - 1) > l[i] // (ans[i] - 1):
			mini = i
	else:
		break
if noans:
	print(0)
else:
	print(l[mini] // (ans[mini] - 1))


a = input()
l = list(map(int, a.split()))
n = l[0]
m = l[1]
b = input()
r = list(map(int, b.split()))
x = []
for i in range(0, 102):
	x.append(0)
for i in r:
	x[i] = x[i] + 1
nx = sorted(x)
vis = 0
ans = 0
for i in range(100, 0, -1):
	bum = i * n
	if vis == 0:
		for j in range(0, len(nx)):
			if nx[j] >= i and vis == 0:
				bum = bum - (nx[j] - nx[j] % i)
				if bum <= 0:
					vis = 1
					ans = i
					break
print(ans)


import collections, atexit, math, sys
from functools import cmp_to_key
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
import bisect
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, **kwargs, file=sys.stderr)
	dprint('debug mode')
except ModuleNotFoundError:

	def dprint(*args, **kwargs):
		pass

def memo(func):
	cache = {}

	def wrap(*args):
		if args not in cache:
			cache[args] = func(*args)
		return cache[args]
	return wrap

@memo
def comb(n, k):
	if k == 0:
		return 1
	if n == k:
		return 1
	return comb(n - 1, k - 1) + comb(n - 1, k)
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N, M) = getIntList()
za = getIntList()
zc = [0 for i in range(101)]
for x in za:
	zc[x] += 1
min_ok = 0
max_not = 101

def work(day):
	c = 0
	for i in range(101):
		c += zc[i] // day
	return c >= N
while min_ok + 1 < max_not:
	mid = (min_ok + max_not) // 2
	if work(mid):
		min_ok = mid
	else:
		max_not = mid
print(min_ok)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
arr = [0] * 101
for i in range(m):
	arr[a[i]] += 1
if m < n:
	print(0)
else:
	ans = 0
	while True:
		k = ans + 1
		c = 0
		for i in range(1, 101):
			c += arr[i] // k
		if c >= n:
			ans += 1
		else:
			break
	print(ans)


(n, m) = map(int, input().split())
data = list(map(int, input().split()))
l = -1
r = m + 1
d = {}
for el in data:
	if d.get(el) is None:
		d[el] = 0
	d[el] += 1

def check(value):
	if value == 0:
		return True
	boys = 0
	for el in d.values():
		boys += el // value
	return boys >= n
ans = 0
while r - l > -1:
	mid = l + r >> 1
	if check(mid):
		ans = mid
		l = mid + 1
	else:
		r = mid - 1
print(ans)


(n, k) = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
t = [l.count(i) for i in set(l)]
z = len(t)
for i in range(k, 0, -1):
	p = 0
	for j in range(z):
		p += int(t[j] / i)
	if p >= n:
		print(i)
		break
else:
	print(0)


(n, m) = map(int, input().split())
b = list(map(int, input().split()))
d = dict()
for j in range(m):
	if b[j] in d.keys():
		d[b[j]] += 1
	else:
		d[b[j]] = 1
c = []
k = list(set(b))
r = len(k)
j = 0
while j < r:
	p = d[k[j]]
	i = 1
	while p // i >= 1:
		c.append(p // i)
		i += 1
	j += 1
c.sort(reverse=True)
if len(c) < n:
	print(0)
else:
	print(c[n - 1])


def mi():
	return map(int, input().split())
(n, m) = mi()
from collections import Counter
a = Counter(list(mi()))
if m < n:
	print(0)
else:
	b = []
	for i in a:
		b.append(a[i])
	b.sort(reverse=True)
	l = 0
	for i in range(1, 101):
		k = 0
		for j in b:
			if j // i > 0:
				k += j // i
		if k >= n:
			l = max(i, l)
	print(l)


from collections import Counter
(n, m) = [int(x) for x in input().split()]
l = input().split()
w = dict(Counter(l)).values()
w = sorted(w)[::-1]
maxDays = w[0]
while True:
	people = 0
	for i in w:
		if maxDays <= i:
			people += i // maxDays
		else:
			break
	if people >= n:
		print(maxDays)
		break
	maxDays -= 1
	if maxDays == 0:
		print(0)
		break


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
c = [0] * 102
for i in l:
	c[i] += 1
f = 1
for i in range(101, 0, -1):
	ans = 0
	for j in range(101):
		ans += c[j] // i
	if ans >= n:
		print(i)
		f = 0
		exit(0)
if f:
	print(0)


d = {}
s = input().split()
n = int(s[0])
m = int(s[1])
s = input().split()
for item in s:
	if item not in d.keys():
		d.update(dict([(item, 1)]))
	else:
		d[item] += 1
cur = 0
while True:
	num = 0
	for item in d.values():
		num += item // (cur + 1)
	if num < n:
		break
	cur += 1
print(cur)


def case(mid):
	res = 0
	for (i, x) in enumerate(d):
		res += d[x] // mid
	return res
(n, m) = map(int, input().split())
lst = list(map(int, input().split()))
d = {}
for (i, x) in enumerate(lst):
	if d.get(x) == None:
		d[x] = 0
	d[x] += 1
(l, r) = (0, max(d.values()))
while l + 1 < r:
	mid = (l + r) // 2
	res = case(mid)
	if res < n:
		r = mid
	else:
		l = mid
if case(r) >= n:
	print(r)
else:
	print(l)


import math
import itertools
from collections import defaultdict
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
(n, m) = getInputIntList()
arr = getInputIntList()
myset = defaultdict(int)
for i in arr:
	myset[i] += 1
l = []
for (k, v) in myset.items():
	l.append(v)
l.sort(reverse=True)
ans = 0
for i in range(100, 0, -1):
	to = 0
	for j in l:
		to += j // i
	if to >= n:
		ans = i
		break
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
if m < n:
	print(0)
elif m == n:
	print(1)
else:
	s = list(set(a))
	o = []
	if len(s) == len(a):
		print(1)
	elif len(s) == 1:
		print(m // n)
	else:
		for i in range(len(s)):
			o.append(a.count(s[i]))
		for i in range(1, 102):
			s = 0
			for j in range(len(o)):
				s = s + o[j] // i
			if s < n:
				print(i - 1)
				break


(p, w) = input().split()
p = int(p)
w = int(w)
f = input().split()
f = [int(i) for i in f]
n = {}
for i in f:
	n[i] = 0
for i in f:
	n[i] += 1
d = 1
while True:
	z = 0
	for (j, i) in n.items():
		z += i // d
	if z < p:
		d = d - 1
		break
	d += 1
print(d)


a = input().split()
n = int(a[0])
m = int(a[1])
a = input().split()
dic = {}
for i in a:
	dic[i] = 0
for i in a:
	dic[i] += 1
maxv = int(max(dic.values()))
flag = False
for i in range(maxv, 0, -1):
	c = 0
	for j in dic:
		c += dic[j] // i
	if c >= n:
		flag = True
		break
if flag:
	print(i)
else:
	print(0)


from collections import defaultdict
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = defaultdict(lambda : 0)
for i in a:
	d[i] += 1
mx = m // n
for i in range(mx, -1, -1):
	curr = 0
	try:
		for j in d:
			curr += d[j] // i
	except:
		print(0)
	if curr >= n:
		print(i)
		break


(n, m) = map(int, input().split())
food = list(map(int, input().split()))
count = {}
for i in food:
	if i in count.keys():
		count[i] += 1
	else:
		count[i] = 1
max_days = m // n
if n > m:
	print(0)
else:
	flag = 0
	for i in range(1, max_days + 1):
		s = 0
		for j in count:
			s += count[j] // i
		if s < n:
			flag = 1
			break
	if flag == 1:
		print(i - 1)
	else:
		print(i)


def rec(l, r):
	global b
	global m
	if l + 1 >= r:
		return l if l != -1 else 0
	m2 = (l + r) // 2
	i = 0
	c = 0
	while i != len(b) and c < n and (b[i] >= m2) and (m2 != 0):
		c += b[i] // m2
		i += 1
	if c < n and m2 != 0:
		return rec(l, m2)
	return rec(m2, r)
(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = []
for item in set(a):
	b.append(a.count(item))
b.sort(reverse=True)
print(rec(-1, b[0] + 1))


from sys import stdin

def get_ints():
	return list(map(int, stdin.readline().strip().split()))
(n, m) = get_ints()
ar = get_ints()
counts = [0] * 105
for num in ar:
	counts[num] += 1
ans = 0
for i in range(1, m + 1):
	cnt = 0
	for j in range(1, 101):
		cnt += counts[j] // i
	if cnt >= n:
		ans = max(ans, i)
print(ans)


def isValid(k):
	last = a[0]
	count = 1
	step = 0
	i = 1
	if count == k and step + 1 == n:
		return True
	elif count == k:
		step += 1
		count = 1
	while i < m:
		if step == n:
			return True
		if count == k:
			step += 1
			count = 1
			if step == n:
				return True
			last = a[i]
		elif a[i] == last:
			count += 1
			if count == k and step + 1 == n:
				return True
		elif a[i] != last:
			last = a[i]
			count = 1
		i += 1
	return False
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
l = 1
h = m
ans = 0
while l <= h:
	mid = (l + h) // 2
	if isValid(mid) == True:
		ans = mid
		l = mid + 1
	else:
		h = mid - 1
print(ans)


nk = input().split(' ')
n = int(nk[0])
raw_food = input().split(' ')
food = [0] * 101
for i in range(len(raw_food)):
	food[int(raw_food[i])] = food[int(raw_food[i])] + 1
maxans = 0
i = 1
people = 0
while i < 101:
	j = 0
	gfood = food.copy()
	people = 0
	while j < 101 and people < n:
		if gfood[j] >= i:
			gfood[j] = gfood[j] - i
			people = people + 1
		elif gfood[j] < i:
			j = j + 1
	if people == n:
		maxans = i
	i = i + 1
print(maxans)


(num_part, num_pack) = [int(i) for i in input().split(' ')]
type_pack = input().split(' ')
dict_count = {}
for element in set(type_pack):
	dict_count[element] = type_pack.count(element)
count = 0
for days in range(1, 101):
	survival = 0
	for element in dict_count:
		survival += dict_count[element] // days
	if survival >= num_part:
		count += 1
	else:
		break
print(count)


from sys import stdin, stdout
from collections import Counter
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))

def pos(n):
	t = 0
	for (k, v) in d.items():
		if v >= n:
			t += v // n
	return t >= p
for _ in range(1):
	(p, n) = lst()
	d = Counter(lst())
	ans = 0
	for sel in range(1, n + 1):
		if pos(sel):
			ans = max(ans, sel)
	print(ans)


(n, k) = map(int, input().split())
d = {}
for e in input().split():
	if e not in d:
		d[e] = 0
	d[e] += 1
a = list(d.values())
l = 0
r = k + 1
while r - l > 1:
	m = (l + r) // 2
	if sum([e // m for e in a]) >= n:
		l = m
	else:
		r = m
print(l)


din = {}

def fn(tot, L, ind):
	if (tot, ind) in din:
		return din[tot, ind]
	l = len(L)
	if tot == 0:
		return -1
	elif ind == l - 1:
		return L[ind] // tot
	else:
		ans = 0
		for i in range(1, tot + 1):
			if i > L[ind]:
				break
			z = fn(tot - i, L, ind + 1)
			a1 = L[ind] // i if z == -1 else min(L[ind] // i, z)
			if a1 > ans:
				ans = a1
		din[tot, ind] = ans
		return ans
[n, m] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
if n > m:
	print('0')
else:
	di = {}
	for i in A:
		if i in di:
			di[i] += 1
		else:
			di[i] = 1
	L = []
	for i in di:
		L.append(di[i])
	L.sort(reverse=True)
	print(fn(n, L, 0))


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
d = {}
for i in a:
	if not i in d:
		d[i] = 0
	d[i] += 1
num = [i for i in d.values()]
num.sort()
l = len(num)
ans = 1
while True:
	s = 0
	for i in num:
		s += i // ans
	if s < n:
		ans -= 1
		break
	ans += 1
print(ans)


import collections
inp = list(map(int, input().split(' ')))
typ = input().split(' ')
count = []
day = 1
while True:
	for i in collections.Counter(typ).values():
		if int(i / day):
			count.append(int(i / day))
	if sum(count) >= inp[0]:
		count = []
		day += 1
	else:
		day -= 1
		break
print(day)


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
d = dict.fromkeys(list(set(a)), 0)
for x in a:
	d[x] += 1
days = 1
fit = True
while fit:
	s = 0
	for x in d.keys():
		s += d[x] // days
	if s >= n:
		days += 1
	else:
		fit = False
		days -= 1
print(days)


from collections import Counter
(n, m) = map(int, input().split())
counter = Counter(map(int, input().split()))
left = 0
right = 100

def canLast(days):
	cnt = 0
	for v in counter.values():
		cnt += v // days
	return True if cnt >= n else False
while left < right:
	mid = (left + right + 1) // 2
	if canLast(mid):
		left = mid
	else:
		right = mid - 1
print(right)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
from collections import Counter
C = Counter(A)

def is_ok(x):
	cnt = 0
	for v in C.values():
		cnt += v // x
	if cnt >= n:
		return True
	else:
		return False
ok = 0
ng = 1000
while ok + 1 < ng:
	c = (ok + ng) // 2
	if is_ok(c):
		ok = c
	else:
		ng = c
print(ok)


(men, food) = map(lambda x: int(x), input().split())
types = map(lambda x: int(x), input().split())
food_dic = {}
for t in types:
	if t in food_dic:
		food_dic[t] += 1
	else:
		food_dic.update({t: 1})
food = list(food_dic.values())
food.sort(reverse=True)
if len(food) < men:
	food += [0] * (men - len(food))
else:
	food = food[:men]
type_list = [i + 1 if food[i] > 0 else 0 for i in range(len(food))]

def get_same(type_list, max_i):
	res = []
	typ = type_list[max_i]
	for i in range(len(type_list)):
		if type_list[i] == typ:
			res.append(i)
	return res
while True:
	max_i = food.index(max(food))
	min_i = food.index(min(food))
	same_i = get_same(type_list, max_i)
	all_f = 0
	for i in same_i:
		all_f += food[i]
	if all_f // (len(same_i) + 1) <= food[min_i]:
		break
	type_list[min_i] = type_list[max_i]
	tru = all_f // (len(same_i) + 1)
	food[min_i] = tru
	for i in same_i:
		food[i] = tru
	for i in range(all_f % (len(same_i) + 1)):
		food[same_i[i]] += 1
print(min(food))


from sys import stdin, stdout
from collections import Counter
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
(n, m) = I()
a = list(I())
x = Counter(a).values()
ans = 1
while sum((y // ans for y in x)) >= n:
	ans += 1
print(ans - 1)


import sys
(n, m) = map(int, input().split())
L = [int(el) for el in input().split()]
L.sort()
L1 = []
L1.append(L.count(L[0]))
for i in range(1, len(L)):
	if L[i] != L[i - 1]:
		L1.append(L.count(L[i]))
zn = 0
for i in range(1, 1000):
	p = n
	for el in L1:
		if el >= i:
			p -= el // i
	if p <= 0:
		zn = i
	if p > 0:
		print(zn)
		sys.exit()


from collections import defaultdict
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
d = defaultdict(int)
l1 = [0]
for i in range(len(l)):
	d[l[i]] += 1
for i in range(1, 101):
	l1.append(int(d[i]))
p = k = 0
l1 = sorted(l1)
if m < n:
	print('0')
	exit(0)
for i in range(1, 101):
	k = 0
	for j in range(100, 100 - n, -1):
		if int(l1[j]) // i > 0:
			k += int(l1[j]) // i
	if k >= n:
		p = max(i, p)
print(p)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
l = []
for i in range(101):
	l.append(0)
for i in range(m):
	l[a[i]] = l[a[i]] + 1
mx = 0
for j in range(1, 101):
	cp = list(l)
	poss = True
	for i in range(n):
		done = False
		for k in range(1, 101):
			if cp[k] >= j:
				cp[k] = cp[k] - j
				done = True
				break
		if not done:
			poss = False
			break
	if poss:
		mx = j
	else:
		break
print(mx)


pf = [int(item) for item in input().split()]
ft = [int(item) for item in input().split()]
if pf[0] > pf[1]:
	print(0)
else:
	ftd = {}
	for x in ft:
		if x in ftd:
			ftd[x] = ftd[x] + 1
		else:
			ftd[x] = 1
	pot = int(pf[1] / pf[0])

	def food(x, d):
		lst = [int(i / x) for i in d.values()]
		if sum(lst) >= pf[0]:
			print(x)
		else:
			food(x - 1, d)
	food(pot, ftd)


from collections import Counter
(n, m) = input().split()
(n, m) = (int(n), int(m))
foods = Counter(map(int, input().split()))
maxPossible = m // n
if maxPossible == 0:
	print(0)
else:
	curMaxDay = 0
	for i in range(1, maxPossible + 1):
		pplFed = 0
		for food in foods:
			numOfFood = foods[food]
			while numOfFood >= curMaxDay + 1:
				numOfFood -= curMaxDay + 1
				pplFed += 1
				if pplFed == n:
					break
			if pplFed == n:
				break
		if pplFed == n:
			curMaxDay += 1
		else:
			break
	print(curMaxDay)


from collections import Counter, defaultdict, deque
read = lambda : list(map(int, input().split()))
getinfo = lambda grid: print(list(map(print, grid)))
p = lambda x: print(x, end=' ')
mod = 10 ** 9 + 7
inf = float('inf')

def lastDay(n, day):
	if day == 0:
		return True
	num = 0
	for val in d.values():
		num += val // day
		if num >= n:
			return True
	return False
while True:
	try:
		(n, m) = read()
		a = read()
		d = Counter(a)
		(l, r) = (0, max(d.values()))
		while l < r - 1:
			mid = (l + r) // 2
			if lastDay(n, mid):
				l = mid
			else:
				r = mid
		if lastDay(n, r):
			print(r)
		else:
			print(l)
	except:
		break


from collections import Counter

def read():
	return int(input())

def readmap():
	return map(int, input().split())

def readlist():
	return list(map(int, input().split()))
(n, m) = readmap()
A = readlist()
c = Counter(A)
freq = []
for v in c.values():
	freq.append(v)
freq.sort(reverse=True)

def ok(i):
	j = n
	for f in freq:
		j -= f // i
	if j <= 0:
		return True
	else:
		return False
for i in reversed(range(1, m + 1)):
	if ok(i):
		print(i)
		quit()
print(0)


(n, m) = map(int, input().split())
l = [int(j) for j in input().split()]
d = dict()
for i in l:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
c = []
for i in d:
	c.append(d[i])
le = 0
ri = 10 ** 10
while le + 1 < ri:
	mi = (le + ri) // 2
	k = 0
	for i in c:
		k = k + i // mi
	if k < n:
		ri = mi
	else:
		le = mi
print(le)


from collections import *
R = lambda : map(int, input().split())
(n, m) = R()
a = Counter(R()).values()
i = 1
while sum((x // i for x in a)) >= n:
	i += 1
print(i - 1)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
y = set(a)
y = list(y)
t = []
for i in y:
	t.append(a.count(i))
t.sort
t.reverse()
ans = 0
s = 0
for i in range(1, 101):
	s = 0
	for j in t:
		s += j // i
		if s >= n:
			break
	if s >= n:
		ans = i
	else:
		break
print(ans)


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)
import sys

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter
import math
import heapq
from heapq import heappop, heappush
import bisect
from itertools import groupby

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a / gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def Bs(a, x):
	i = 0
	j = 0
	left = 0
	right = len(a)
	flag = False
	while left < right:
		mi = (left + right) // 2
		if a[mi] <= x:
			left = mi + 1
			i += 1
		else:
			right = mi
			j += 1
	if left > 0 and a[left - 1] == x:
		return (i - 1, j)
	else:
		return (-1, -1)

def nCr(n, r):
	return fact(n) // (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def primefactors(n):
	num = 0
	while n % 2 == 0:
		num += 1
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			num += 1
			n = n // i
	if n > 2:
		num += 1
	return num

def ask(a):
	print('? {}'.format(a), flush=True)
	n = lint()
	return n

def dfs(i, p):
	(a, tmp) = (0, 0)
	for j in d[i]:
		if j != p:
			a += 1
			tmp += dfs(j, i)
	if a == 0:
		return 0
	return tmp / a + 1
(n, m) = lint()
s = lint()
d = Counter(s)
st = 1
en = m
ans = 0
while st <= en:
	mid = (st + en) // 2
	tmp = 0
	for i in set(s):
		tmp += d[i] // mid
	if tmp >= n:
		ans = mid
		st = mid + 1
	else:
		en = mid - 1
print(ans)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
m = [0] * 101
for i in a:
	m[i] += 1
fin = []
for i in m:
	if i != 0:
		fin.append(i)
fin.sort()
ans = 0
d = 1
flag = 0
while flag != 1:
	p = 0
	for i in fin:
		p += i // d
	if p < n:
		break
	ans = d
	d += 1
print(ans)


from collections import Counter
from operator import itemgetter
(n, m) = map(int, input().split())
packs = Counter(map(int, input().split()))
l = sorted(packs.items(), key=itemgetter(1), reverse=True)
if m < n:
	print(0)
else:
	a = 1
	b = l[0][1] + 1
	while b > a + 1:
		c = (a + b) // 2
		num = sum([p[1] // c for p in l])
		if num >= n:
			a = c
		else:
			b = c
	print(a)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
day = 1

def poss(day):
	q = 0
	mp = dict()
	for el in a:
		if el not in mp:
			mp[el] = 1
		else:
			mp[el] += 1
	for el in mp:
		q += mp[el] // day
	return q >= n
while poss(day):
	day += 1
print(day - 1)


from collections import defaultdict
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
rec = defaultdict(int)
for i in range(m):
	rec[a[i]] += 1

def ok(k):
	if k == 0:
		return False
	tmp = 0
	for i in rec.values():
		tmp += i // k
	return tmp >= n
(left, right) = (0, 10000)
p = 0
while p < 1000:
	mid = (left + right) // 2
	q = ok(mid)
	if q:
		left = mid
	else:
		right = mid
	p += 1
print(mid)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import defaultdict as dd
from collections import deque
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdmap = lambda : map(int, stdstr().split())
stdarr = lambda : list(map(int, stdstr().split()))
mod = 1000000007
(n, m) = stdmap()
arr = stdarr()
if n > m:
	print(0)
else:
	c = Counter(arr)
	d1 = list(sorted(c.values()))
	days = 0
	for i in range(1, 101):
		br = False
		d = d1.copy()
		people = 0
		done = False
		while 1:
			if people >= n:
				days = i
				done = True
				break
			else:
				if len(d) == 0:
					break
				curr = d[-1] // i
				d.pop()
				people += curr
		if done:
			days = i
	print(days)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
a = set(l)
a = list(a)
z = []
for i in range(len(a)):
	z.append(l.count(a[i]))
for j in range(m, 0, -1):
	p = 0
	for s in range(len(z)):
		p += int(z[s] / j)
	if p >= n:
		print(j)
		break
else:
	print(0)


def bs(l, h):
	while l < h:
		m = (l + h + 1) // 2
		if gf(m):
			l = m
		else:
			h = m - 1
	return l

def gf(x):
	y = 0
	for i in b:
		y += i // x
	return y >= n
(n, m) = map(int, input().split())
a = map(int, input().split())
b = [0] * 101
for i in a:
	b[i] += 1
print(bs(0, sum(b) // n))


import sys
from collections import Counter
(n, m) = map(int, input().split())
a = Counter(map(int, input().split()))
a = sorted(list(a.values()), reverse=True)
m = len(a)
total = sum(a)
if total < n:
	print(0)
	sys.exit()
guess = total // n
done = False
while not done:
	i = 0
	served = 0
	while served < n and i < m:
		served += a[i] // guess
		i += 1
	if served >= n:
		done = True
	else:
		guess -= 1
print(guess)


from queue import PriorityQueue
import copy
import math
nmlist = input()
nm = [int(i) for i in nmlist.split()]
qnt_pessoas = nm[0]
qnt_comida = nm[1]
coef = int(qnt_comida / qnt_pessoas)
comida = {}
mlist = input()
for i in mlist.split():
	i = int(i)
	if i not in comida:
		comida[i] = 0
	comida[i] += 1
q = PriorityQueue()
for i in comida:
	q.put((-comida[i], i))

def last_n_days(days, q):
	qcopy = PriorityQueue()
	qcopy.queue = copy.deepcopy(q.queue)
	last = 0
	n = qnt_pessoas
	while not qcopy.empty() and n > 0:
		entry = qcopy.get()
		last += -entry[0] // days
		n -= 1
	return last - qnt_pessoas

def busca_binaria(left, right):
	repeat = 0
	while True:
		mid = int((left + right) / 2)
		res = last_n_days(mid, q)
		if abs(left - right) == 1:
			repeat += 1
		if left - right == 0 or repeat > 10:
			return mid
		if res >= 0:
			left = mid
		else:
			right = mid
if qnt_pessoas > qnt_comida:
	print(0)
elif last_n_days(coef, q) == 0:
	print(coef)
else:
	print(busca_binaria(1, coef))


(n, m) = map(int, input().split())
d = {}
s = list(map(int, input().split()))
for c in s:
	if c in d:
		d[c] += 1
	else:
		d[c] = 1
d = list(d.values())
for k in range(m, 0, -1):
	l = 0
	for v in d:
		l += v // k
		if l >= n:
			print(k)
			exit(0)
print(0)


import math
from bisect import bisect_right, bisect_left
from collections import Counter
from heapq import heappop, heappush
from itertools import accumulate
R = lambda : map(int, input().split())
(n, m) = R()
cnts = list(Counter(R()).values())
(l, r) = (0, m)
while l < r:
	mid = (l + r + 1) // 2
	sp = sum((x // mid for x in cnts))
	if sp >= n:
		l = mid
	else:
		r = mid - 1
print(l)


(n, m) = map(int, input().split())
d = {}
ans = cnt = 0
for i in map(int, input().split()):
	d[i] = d.get(i, 0) + 1
for i in range(1, m + 1):
	cnt = 0
	for v in d.items():
		cnt += v[1] // i
	if cnt >= n:
		ans = i
print(ans)


(m, n) = input().strip().split(' ')
(m, n) = (int(m), int(n))
arr = list(map(int, input().strip().split(' ')))
days = 0
if m > n:
	print(0)
else:
	mp = {}
	for i in arr:
		if i in mp:
			mp[i] += 1
		else:
			mp[i] = 1
	temp = []
	for i in mp:
		temp.append(mp[i])
	temp.sort()
	days = 0
	j = 1
	while 1:
		cnt = 0
		for i in temp:
			cnt += i // j
			if cnt >= m:
				break
		if cnt < m:
			break
		days += 1
		j += 1
	print(days)


(n, m) = map(int, input().strip().split())
l = list(map(int, input().strip().split()))
l1 = [0 for i in range(101)]
for i in l:
	l1[i] = l1[i] + 1
for i in range(100, 0, -1):
	r = 0
	for j in range(1, 101):
		r = r + l1[j] // i
	if r >= n:
		print(i)
		exit(0)
print(0)


(n, m) = map(int, input().split())
a = map(int, input().split())
dic = [0] * 101
for x in a:
	dic[x] += 1

def ok(x):
	cnt = 0
	for i in dic:
		cnt += i // x
	return cnt >= n
for x in range(100, 0, -1):
	if ok(x):
		print(x)
		exit(0)
print(0)


(n, k) = input().split()
s = input().split()
(n, k) = (int(n), int(k))
d = sorted(s)
ref = d[0]
if k > 1 and n <= k:
	counts = []
	count = 1
	for i in range(1, len(d)):
		if d[i] == ref:
			count += 1
		else:
			counts.append((d[i - 1], count))
			count = 1
			ref = d[i]
	counts.append((d[i], count))
	for i in range(k, 0, -1):
		add = 0
		for j in range(0, len(counts)):
			add += counts[j][1] // i
		if add >= n:
			ans = i
			break
elif k == 1 and n == 1:
	ans = 1
else:
	ans = 0
print(ans)


(n, m) = map(int, input().split())
u = list(map(int, input().split()))
u.sort()
cp = []
cnt = 1
for i in range(1, m):
	if u[i] == u[i - 1]:
		cnt += 1
	else:
		cp.append(cnt)
		cnt = 1
cp.append(cnt)
cp.sort(reverse=1)
p = len(cp)

def chek(k):
	ind = 0
	cp1 = cp[:]
	for i in range(n):
		while ind < p and cp1[ind] < k:
			ind += 1
		if ind >= p:
			return False
		cp1[ind] -= k
	return True
L = 0
R = cp[0]
while R - L > 1:
	m = (L + R) // 2
	if chek(m):
		L = m
	else:
		R = m
if chek(R):
	print(R)
else:
	print(L)


t = 1
for test in range(t):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	count = [0 for i in range(101)]
	for i in a:
		count[i] += 1
	count.sort()
	ans = 0
	tmp = 0
	for i in range(1, 101):
		tmp = n
		for j in count:
			tmp -= j // i
		if tmp > 0:
			break
		else:
			ans = i
	print(ans)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = [0] * 101
for i in a:
	cnt[i] += 1
cnt.sort(reverse=True)
ans = 0
for i in range(1, 101):
	k = 0
	for j in range(101):
		k += cnt[j] // i
		if k >= n:
			ans = max(ans, i)
			break
print(ans)


from collections import Counter
from time import sleep

def solve(participants_count, packages):
	possible_days_count = 1
	sorted_values = sorted(packages.values(), reverse=True)
	while True:
		number_of_survivors_in_n_days = sum((value // possible_days_count for value in sorted_values))
		if number_of_survivors_in_n_days < participants_count:
			return possible_days_count - 1
		possible_days_count += 1
(participants_count, _) = map(int, input().split())
packages = Counter(input().split())
print(solve(participants_count, packages))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7

def ssinp():
	return input()

def iinp():
	return int(input())

def nninp():
	return map(int, input().split())

def llinp():
	return list(map(int, input().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
import math
from collections import OrderedDict
import operator
(n, m) = nninp()
if n > m:
	print(0)
	exit()
a = llinp()
d = {}
for c in a:
	if c in d:
		d[c] += 1
	else:
		d[c] = 1
dict1 = dict(sorted(d.items(), key=operator.itemgetter(1)))
ans = 0
for i in range(1, 105):
	temp = dict1.copy()
	n1 = n
	for c in temp:
		n1 = n1 - temp[c] // i
	if n1 > 0:
		print(i - 1)
		exit()


from collections import Counter

def _cal(arr, x):
	ans = 0
	for i in arr:
		ans += int(i / x)
	return ans

def main():
	(n, m) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	if n > m:
		print(0)
		return
	n_of_each_type = list(Counter(a).values())
	max_val = max(n_of_each_type)
	x = None
	for i in range(1, max_val + 1, 1):
		val = _cal(n_of_each_type, i)
		if val >= n:
			x = i
	if x:
		print(x)
	else:
		print(0)
main()


def solve(n, m, arr):
	fp = [0] * 105
	for t in arr:
		fp[t] += 1
	msf = 0
	for d in range(1, 101):
		count = 0
		for t in fp:
			count += t // d
		if count < n:
			continue
		msf = max(msf, d)
	return msf

def main():
	(n, m) = [int(x) for x in input().strip().split()]
	arr = [int(x) for x in input().strip().split()]
	print(solve(n, m, arr))
main()


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
res = [0] * 100

def prov(x):
	s = 0
	for y in range(100):
		if x == 0:
			return 1
		s += res[y] // x
	if s >= n:
		return 1
	return 0
for i in range(m):
	res[a[i] - 1] += 1
l = 0
r = 1000
while r - l > 1:
	m = (l + r) // 2
	if prov(m):
		l = m
	else:
		r = m
print(l)


from collections import Counter
(k, n) = list(map(int, input().split()))
a = list(map(int, input().split()))
a = dict(Counter(a))
a = sorted(list(a.values()), reverse=True)
i = a[0]
while i >= 1:
	count = 0
	for j in range(len(a)):
		count += a[j] // i
	if count >= k:
		break
	i -= 1
if i == 0:
	print(0)
else:
	print(i)


def bs(mid, a, z1):
	i = 0
	k = 0
	z = z1.copy()
	f = 0
	while i < len(z):
		if z[i] >= mid:
			while z[i] >= mid:
				f += 1
				z[i] -= mid
		else:
			i += 1
	if f >= a:
		return 1
	return 0
(a, b) = map(int, input().split())
z1 = dict()
for i in map(int, input().split()):
	z1[i] = z1.get(i, 0) + 1
z = sorted(z1.values(), reverse=True)
lo = 1
hi = 100
ans = 0
while lo <= hi:
	mid = lo + (hi - lo) // 2
	if bs(mid, a, z):
		ans = mid
		lo = mid + 1
	else:
		hi = mid - 1
print(ans)


def main():
	(n, m) = map(int, input().split())
	if n > m:
		print(0)
		return
	cnt = {}
	for a in map(int, input().split()):
		cnt[a] = cnt.get(a, 0) + 1
	(lo, hi) = (1, 100)
	for _ in range(8):
		(mid, x) = ((lo + hi) // 2, n)
		for c in cnt.values():
			x -= c // mid
		if x > 0:
			hi = mid
		else:
			lo = mid + 1
	print(lo - 1)
main()


from collections import Counter
(n, m) = list(map(int, input().split()))
food = sorted([(q, t) for (t, q) in Counter(list(map(int, input().split()))).items()])

def ration(n, f, t):
	result = 0
	for (q, _) in f:
		result += q // t
	if result < n:
		return 0
	else:
		return 1
days = 0
while ration(n, food, days + 1):
	days += 1
print(days)


import itertools
import collections
import sys
import math
input = sys.stdin.readline
read = lambda : input().rstrip()
puts = sys.stdout.write

def read_ints():
	yield from map(int, read().split())

def main():
	(n, m) = read_ints()
	a = collections.Counter(read_ints())
	ans = 0
	for days in range(1, m + 1):
		can = 0
		for (k, v) in a.items():
			can += v // days
		if can >= n:
			ans = days
	print(ans)
main()


h = input()
x = h.split()
n = int(x[0])
m = int(x[1])
i = 0
z = input()
z2 = z.split()
list = []
while i < m:
	list.append(int(z2[i]))
	i = i + 1
import time
start = time.time()
s = {}
for ele in list:
	if ele not in s:
		s[ele] = 1
	else:
		s[ele] = s[ele] + 1
val = []
for ele in s:
	val.append(s[ele])
val.sort(reverse=True)

def maxim(list2):
	lenth = len(list2)
	i = 0
	maximum = list2[0].count / list2[0].ppl
	pos = 0
	while i < lenth:
		if maximum < list2[i].count / list2[i].ppl:
			maximum = list2[i].count / list2[i].ppl
			pos = i
		i = i + 1
	return pos

def minimu(list2):
	lenth = len(list2)
	i = 0
	minim = list2[0].count / list2[i].ppl
	pos = 0
	while i < lenth:
		if minim > list2[i].count / list2[i].ppl:
			minim = list2[i].count / list2[i].ppl
			pos = i
		i = i + 1
	return pos

def minimu2(list2):
	lenth = len(list2)
	i = 0
	minim = list2[0].count
	pos = 0
	while i < lenth:
		if minim > list2[i].count:
			minim = list2[i].count
			pos = i
		i = i + 1
	return pos
list2 = []

class num:
	count = 0
	ppl = 0
	name = 0
for ele in s:
	j = num()
	j.name = ele
	j.count = s[ele]
	list2.append(j)

def divin2(list2):
	h = maxim(list2)
	l = minimu(list2)
	if list2[h].count / (list2[h].ppl + 1) > list2[l].count / list2[l].ppl:
		list2[h].ppl = list2[h].ppl + 1
		list2[l].ppl = list2[l].ppl - 1
		if list2[l].ppl == 0:
			list2.pop(l)
		return divin2(list2)
	else:
		return int(list2[l].count / list2[l].ppl)

def dividing(list2, n, s, m, val):
	if n > m:
		return 0
	lenth = len(list2)
	if lenth == 1:
		return list2[0].count / n
	if n < lenth:
		pos = 0
		while len(list2) != n:
			pp = minimu2(list2)
			list2.pop(pp)
		return dividing(list2, n, s, m, val)
	elif n == lenth:
		for ele in list2:
			ele.ppl = 1
		h = maxim(list2)
		l = minimu(list2)
		if list2[h].count / (list2[h].ppl + 1) > list2[l].count:
			list2[h].ppl = list2[h].ppl + 1
			list2.pop(l)
			return divin2(list2)
		else:
			return list2[l].count
	if n > lenth:
		for ele in list2:
			ele.ppl = 1
		g = n - lenth
		i = 0
		while i < g:
			h = maxim(list2)
			list2[h].ppl = list2[h].ppl + 1
			i = i + 1
		l = minimu(list2)
		return int(list2[l].count / list2[l].ppl)
counts = int(dividing(list2, n, s, m, val))
print(counts)
end = time.time()


n = list(map(int, input().split()))
t = list(map(int, input().split()))
tx = set(t)

def check(x):
	z = 0
	w = 0
	for p in range(1, x + 1):
		for i in tx:
			z += int(t.count(i) / p)
		if z >= n[0]:
			w = p
		z = 0
	return w
maxi = []
for i in tx:
	a = check(t.count(i))
	maxi.append(a)
maxi.sort()
if len(maxi) == 0:
	print(0)
else:
	print(maxi[len(maxi) - 1])


(n, m) = map(int, input().split(' '))
inputs = list(map(int, input().split(' ')))
l = [0] * 100
for i in inputs:
	l[i - 1] += 1
order = []
for i in range(100):
	if l[i] != 0:
		order.append(l[i])
best = 0
for i in range(100, 0, -1):
	num = 0
	for c in order:
		num += int(c / i)
	if num >= n:
		best = i
		break
print(int(best))


def proverka(k, n):
	kol = 0
	i = 0
	while i < len(count) and kol < n:
		kol += count[i] // k
		i += 1
	return kol >= n
(n, m) = map(int, input().split())
myList = list(map(int, input().split()))
count = [0] * 101
for elem in myList:
	count[elem] += 1
s = sum(count)
if s < n:
	print(0)
else:
	k = 1
	new_k = 2
	count.sort(reverse=True)
	while True:
		if proverka(new_k, n):
			k = new_k
			new_k = k + 1
		else:
			break
	print(k)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
dic = dict()
for i in range(m):
	if a[i] not in dic:
		dic[a[i]] = 1
	else:
		dic[a[i]] += 1
b = 1
while sum((dic[i] // b for i in dic)) >= n:
	b += 1
print(b - 1)


from math import *
import sys
input = sys.stdin.readline

def can(days, n, a):
	cnt = 0
	for i in range(len(a)):
		cnt += a[i] // days
		if cnt >= n:
			return True
	return False

def main():
	(n, m) = [int(x) for x in input().split(' ')]
	b = [int(x) for x in input().split(' ')]
	a = [0 for i in range(101)]
	for i in b:
		a[i] += 1
	a = sorted(a)
	pos = 0
	for i in range(25, -1, -1):
		jump = 1 << i
		if can(pos + jump, n, a):
			pos += jump
	print(pos)
main()


(k, n) = map(int, input().split())
from collections import Counter
m = list(Counter(list(map(int, input().split()))).values())
m.sort()
m.reverse()
ans = 1

def check(x):
	cc = k
	for i in m:
		cc -= i // x
		if cc <= 0:
			return True
	return False
while check(ans):
	ans += 1
print(ans - 1)


(n, k) = map(int, input().split())
ar = list(map(int, input().split()))
a = [0] * 101
if n > k:
	print('0')
else:
	for i in range(k):
		x = ar[i]
		a[x] += 1
	maxp = k // n
	while maxp > 1:
		count = 0
		flag = 0
		for i in range(101):
			count = count + a[i] // maxp
			if count >= n:
				flag = 1
				break
		if flag == 1:
			break
		elif flag == 0:
			maxp = maxp - 1
	print(maxp)


(n, m) = map(int, input().split())
from collections import *
a = [*Counter(input().split()).values()]
d = m // n
while d > 0:
	if sum((c // d for c in a)) >= n:
		break
	d -= 1
print(d)


import collections
(n, l) = map(int, input().split())
array = list(map(int, input().split()))
c = collections.Counter(array).values()
cur = 1
while sum((x // cur for x in c)) >= n:
	cur += 1
print(cur - 1)


from collections import Counter
(n, m) = map(int, input().split())
d = list(Counter(map(int, input().split())).values())
for ans in range(1, 1000):
	if sum([x // ans for x in d]) < n:
		print(ans - 1)
		break


from collections import Counter
(n, m) = map(int, input().split())
c = Counter(input().split()).values()
d = 1
while sum((ci // d for ci in c)) >= n:
	d += 1
print(d - 1)


(n, m) = map(int, input().split())
c = {}
for x in map(int, input().split()):
	c[x] = c.get(x, 0) + 1
ans = 1
while sum((c[i] // ans for i in c)) >= n:
	ans += 1
print(ans - 1)


(n, m) = list(map(int, input().split()))
c = list(map(int, input().split()))
m = max(c)
a = []
for i in range(m + 1):
	a.append(c.count(i))
p = [0] * (m + 1)
curmax = 10 ** 9
for i in range(n):
	ind = 0
	best_result = 0
	for j in range(m + 1):
		current_result = 10 ** 9
		for k in range(m + 1):
			mn = p[k]
			if k == j:
				mn += 1
			if mn == 0:
				continue
			current_result = min(current_result, a[k] // mn)
		if current_result > best_result:
			best_result = current_result
			ind = j
	p[ind] += 1
ans = 10 ** 9
for i in range(m + 1):
	if p[i] > 0:
		ans = min(ans, a[i] // p[i])
print(ans)


import math
(n, m) = map(int, input().split())
packages = list(map(int, input().split()))
total = {}
for i in packages:
	if i not in total.keys():
		total[i] = 1
	else:
		total[i] += 1
dict_sort = sorted(total.items(), key=lambda kv: kv[1], reverse=True)
(start, end, mid, ret) = (1, len(packages), 0, 0)
while start <= end:
	c = 0
	mid = int((start + end) / 2)
	for i in range(len(dict_sort)):
		try:
			c += int(dict_sort[i][1] / mid)
		except ZeroDivisionError as z:
			break
	if c >= n:
		start = mid + 1
		ret = mid
	else:
		end = mid - 1
print(ret)


import copy
from collections import Counter
(part_n, food_n) = list(map(int, input().split()))
data = list(map(int, input().split()))
data_c = Counter(data)
data = []
for value in data_c.values():
	data.append(value)
best = 0
data_l = len(data)
for ndays in range(1, 105):
	tmp = copy.deepcopy(data)
	happy = 0
	i = 0
	while i < data_l:
		if tmp[i] >= ndays:
			tmp[i] -= ndays
			happy += 1
		else:
			i += 1
	if happy < part_n:
		print(ndays - 1)
		break


s = input().split(' ')
(n, m) = [int(s[i]) for i in range(0, 2)]
s = input().split(' ')
a = [int(s[i]) for i in range(0, m)]
a.sort()
b = [[a[0], 1]]
j = 0
for i in range(1, len(a)):
	if a[i] == a[i - 1]:
		b[j][1] += 1
	else:
		j += 1
		b += [[a[i], 1]]
b.sort(key=lambda i: i[1])
b.reverse()
c = []
for i in range(0, len(b)):
	c += [b[i][1]]
l = len(c)
find = False
res = 0
for i1 in range(100, 0, -1):
	d = []
	d += c
	i2 = 0
	for i3 in range(0, n):
		if d[i2] - i1 >= 0:
			d[i2] -= i1
		elif i2 + 1 < l:
			i2 += 1
			if d[i2] - i1 >= 0:
				d[i2] -= i1
			else:
				break
		else:
			break
	else:
		find = True
		res = i1
		break
print(res)


(n, m) = map(int, input().split())
a = map(int, input().split())
di = {}
for i in a:
	if i not in di:
		di[i] = 1
	else:
		di[i] += 1
for d in range(100, 0, -1):
	k = 0
	dic = di.copy()
	for i in di.keys():
		k += dic[i] // d
	if k >= n:
		print(d)
		exit()
print(0)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
freq = [0] * 101
for i in range(m):
	freq[a[i]] += 1
maxx = max(freq)
maximi = 0
for i in range(maxx, 0, -1):
	cou = 0
	for x in range(101):
		if freq[x] >= i:
			pp = freq[x]
			cou += pp // i
	if cou >= n:
		maximi = max(maximi, i)
print(maximi)


def Ludi(t, d):
	sum = 0
	if t != 0:
		for i in d:
			sum += d[i] // t
		return sum
	else:
		return 0
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in range(len(a)):
	d.setdefault(a[i], 0)
	d[a[i]] += 1
l = 0
r = 10 ** 18 + 1
while l + 1 < r:
	t = (l + r) // 2
	if Ludi(t, d) >= n:
		l = t
	else:
		r = t
print(l)


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
freq = [0 for _ in range(110)]
for food in a:
	freq[food] += 1

def canfeeddays(days):
	people = 0
	for food in freq:
		people += food // days
	return people
days = 0
while canfeeddays(days + 1) >= n:
	days += 1
print(days)


import sys
import string
from collections import Counter, defaultdict
from math import fsum, sqrt, gcd, ceil, factorial
from operator import add
inf = float('inf')
flush = lambda : sys.stdout.flush
comb = lambda x, y: factorial(x) // factorial(y) // factorial(x - y)
ip = lambda : input()
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
(k, n) = r()
arr = rr()
x = Counter(arr)
arr = list(x.values())
ans = 0
for i in range(1, 101):
	c = 0
	for j in arr:
		c += j // i
	if c >= k:
		ans = max(ans, i)
print(ans)


(n, m) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
d = dict()
for i in a:
	try:
		d[i] += 1
	except:
		d[i] = 1
res = []
for k in d.keys():
	res.append(d[k])
res.sort()
res = res[::-1]
maxt = m // n
j = maxt
while j > 0:
	tot = j * n
	for r in res:
		tot -= r // j * j
	if tot <= 0:
		maxt = j
		j = 0
	else:
		j -= 1
print(maxt)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
d = {}
for i in arr:
	if i in d.keys():
		d[i] += 1
	else:
		d[i] = 1
days = 1
while True:
	count = 0
	for i in d.keys():
		count += d[i] // days
	if count < n:
		break
	days += 1
print(days - 1)


(n, m) = map(int, input().split())
v = list(map(int, input().split()))
d = {}
for i in range(1, 101):
	d[i] = 0
for i in v:
	d[i] += 1
if n > m:
	print(0)
else:
	possible = m // n
	flag = False
	ret = 0
	while possible > 0:
		count = 0
		for value in d.values():
			count += value // possible
			if count >= n:
				flag = True
				ret = possible
			if flag:
				break
		if flag:
			break
		else:
			possible -= 1
	if flag:
		print(ret)
	else:
		print(0)


(n, m) = [int(x) for x in input().split()]
a = list(map(int, input().split()))
if n == m:
	print(1)
	exit()
d = dict()
v = []
for i in range(101):
	d[i] = 0
for i in range(m):
	d[a[i]] += 1
for i in range(101):
	if d[i]:
		v.append(d[i])
v.sort()
maxa = 0
if len(v) == 1:
	print(v[0] // n)
	exit()
for i in range(0, len(v)):
	num = v[i]
	for k in range(1, num + 1):
		c = 0
		for j in range(i, len(v)):
			c += v[j] // k
			if c >= n and k > maxa:
				maxa = k
print(maxa)


x = input()
n = int(x.split(' ')[0])
k = int(x.split(' ')[1])
lis = input().split(' ')
lis = [int(i) for i in lis]
s = set(lis)
dic = {}
for y in s:
	dic[y] = 0
for i in range(k):
	dic[lis[i]] += 1
lis = []
for key in dic:
	lis.append(dic[key])
lis.sort(reverse=True)
j = 0
while True:
	count = 0
	for r in lis:
		count += r // (j + 1)
	if count >= n:
		j += 1
	else:
		break
	if j > k:
		break
print(j)


(n, m) = map(int, input().split())
l = [int(i) for i in input().split()]
lo = 1
hi = 10 ** 5
ans = 0
from collections import Counter
c = Counter(l)

def pzbl(mi):
	sm = 0
	for i in c:
		sm += c[i] // mi
	return sm >= n
while lo <= hi:
	mi = (lo + hi) // 2
	if pzbl(mi):
		ans = mi
		lo = mi + 1
	else:
		hi = mi - 1
print(ans)


(n, m) = map(int, input().split())
a = {}
for i in map(int, input().split()):
	if not i in a:
		a[i] = 0
	a[i] += 1
(l, r) = (0, m)
while l != r:
	k = (l + r + 1) // 2
	if k == 0:
		p = n
	else:
		p = sum([y // k for (x, y) in a.items()])
	if p >= n:
		l = k
	else:
		r = k - 1
print(l)


def f():
	(n, m) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	freq = {}
	for i in l:
		try:
			freq[i] += 1
		except:
			freq[i] = 1
	freq = list(freq.items())
	freq.sort(key=lambda i: i[1], reverse=True)
	for i in range(100, 0, -1):
		cap = 0
		for j in freq:
			cap += j[1] // i
		if cap >= n:
			print(i)
			break
	else:
		print(0)
f()


R = lambda : list(map(int, input().split()))
(n, m) = R()
a = R()
d = {}
for i in a:
	d[i] = 0
for i in a:
	d[i] += 1
b = 1
while sum((d[i] // b for i in d)) >= n:
	b += 1
print(b - 1)


def main():
	(n, m) = [int(x) for x in input().split()]
	types = [int(x) for x in input().split()]
	if n > m:
		print(0)
		return
	dt = {}
	for t in types:
		if t not in dt:
			dt[t] = 0
		dt[t] += 1
	sorted_items = sorted(dt.items(), key=lambda i: i[1], reverse=True)
	for i in range(sorted_items[0][1], 0, -1):
		n_count = 0
		for (k, v) in sorted_items:
			n_count += v // i
		if n_count >= n:
			print(i)
			return
	print(0)
main()


(n, days) = list(map(int, input().split()))
arr = list(map(int, input().split()))
d = {}
for i in arr:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
(low, high) = (1, days // n)
while low < high:
	mid = (low + high) // 2
	cnt = 0
	for i in d:
		if d[i] >= mid:
			cnt += d[i] // mid
	if cnt >= n:
		low = mid
	elif cnt < mid:
		high = mid
	if abs(low - high) == 1:
		break
if days < n:
	print(0)
else:
	cnt = 0
	for i in d:
		if d[i] >= high:
			cnt += d[i] // high
	if cnt >= n:
		print(high)
	else:
		print(low)


def getWeight(a):
	return ord(a) - ord('a') + 1
(n, m) = input().strip().split(' ')
n = int(n)
m = int(m)
if m < n:
	print('0')
	exit(0)
if n <= 0:
	print('0')
	exit(0)
if m <= 0:
	print('0')
	exit(0)
d = {}
arr = list(map(int, input().strip().split(' ')))
for x in arr:
	try:
		d[x] += 1
	except KeyError:
		d[x] = 1
arr = sorted(d.values(), reverse=True)
ret = 0
for i in range(1, arr[0] + 1):
	count = 0
	for x in arr:
		count += int(int(x) / int(i))
		if count >= n:
			ret = i
			break
print(ret)


from collections import defaultdict
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
deft = defaultdict(int)
for v in a:
	deft[v] += 1
if n > m:
	print(0)
	exit(0)
for i in range(1, 102):
	min = 0
	for (x, y) in deft.items():
		if y >= i:
			for j in range(1, n + 1):
				if y // j < i:
					min += j - 1
					break
				if y // n >= i:
					min += n
					break
		else:
			continue
	if min < n:
		print(i - 1)
		exit(0)


[n, m] = [int(i) for i in input().split()]
foods = [0] * 101
flag = 0
for i in input().split():
	foods[int(i)] += 1
for d in range(m, 0, -1):
	copy = list(foods)
	k = 0
	for i in range(101):
		while copy[i] >= d:
			k += 1
			copy[i] -= d
	if k >= n:
		print(d)
		flag = 1
		break
if not flag:
	print(0)


(nbParticipants, nbFood) = map(int, input().split())
food = [int(i) for i in input().split()]
food.sort()
nb = [0 for i in range(100)]
for i in food:
	nb[i - 1] += 1
for nbJours in range(1, 101):
	if sum([nb[i] // nbJours for i in range(100)]) < nbParticipants:
		maximum = nbJours - 1
		break
	maximum = nbJours
print(maximum)


from collections import Counter
(n, m) = [int(x) for x in input().split()]
lab = [int(x) for x in input().split()]
cnt = sorted(Counter(lab).most_common(), key=lambda x: x[1])
res = 0
for amt_ in range(1, cnt[-1][1] + 1):
	if sum([int(y / amt_) for (x, y) in cnt if y >= amt_]) >= n:
		res = amt_
	else:
		break
print(res)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
hsh = [0] * max(a)
for i in a:
	hsh[i - 1] += 1
ans = 0
for i in range(1, k + 1):
	cnt = 0
	for j in hsh:
		cnt += j // i
	if cnt >= n:
		ans = i
print(ans)


(n, m) = map(int, input().split())
FOOD = list(map(int, input().split()))
FOODlist = [0 for i in range(101)]
for i in range(m):
	FOODlist[FOOD[i]] += 1
FOODlist.sort(reverse=True)
last = FOODlist.index(0)
FOODlist = FOODlist[:last]
day = 0
while True:
	checkday = day + 1
	checkpeople = n
	for i in range(len(FOODlist)):
		checkpeople = checkpeople - FOODlist[i] // checkday
	if checkpeople <= 0:
		day += 1
	else:
		break
print(day)


from copy import copy
(n, m) = map(int, input().split())
arr = [0] * 101
a = list(map(int, input().split()))
for i in a:
	arr[i] += 1
d = 100
f = False
while d >= 1:
	cc = copy(arr)
	k = 0
	for i in range(1, 101):
		while cc[i] >= d:
			k += 1
			cc[i] -= d
	if k >= n:
		print(d)
		f = True
		break
	d -= 1
if not f:
	print(0)


from itertools import groupby
(n, k) = [int(x) for x in input().split()]
values = [int(x) for x in input().split()]
result = 0
if n > k:
	pass
elif n == k:
	result = 1
else:
	values = sorted(values)
	max_days = k // n
	while max_days:
		humans = n
		count = 0
		current_item = None
		for (_, items) in groupby(values):
			l = len(list(items))
			humans = max(humans - l // max_days, 0)
			if humans == 0:
				break
		if humans == 0:
			break
		else:
			max_days -= 1
	result = max_days
print(result)


import collections
(n, m) = map(int, input().split())
s = list(map(int, input().split()))
x = list(collections.Counter(s).values())
y = list(collections.Counter(s).keys())
ans = 0
for i in range(m, 0, -1):
	c = 0
	for j in x:
		c += j // i
	if c >= n:
		print(i)
		exit()
print(0)


def val(x, r, n):
	k = 0
	if r == 0:
		return 0
	for i in x:
		k += i // r
	if k >= n:
		return 1
	return 0
import bisect as bi
I = lambda : map(int, input().split())
(n, k) = I()
a = list(I())
d = {}
for i in a:
	d[i] = d.get(i, 0) + 1
k = sorted(d.values())[::-1]
an = 0
l = 0
r = 1000
while l <= r:
	mid = (l + r + 1) // 2
	if not val(k, mid, n):
		r = mid - 1
	else:
		l = mid + 1
		an = mid
print(an)


(n, m) = [int(x) for x in input().split(' ')]
types = [int(x) for x in input().split(' ')]
packs = [0] * 128
for tt in types:
	packs[tt] += 1
best = 0
for days in range(1, 1024):
	support = 0
	for p in packs:
		support += p // days
	if support >= n:
		best = days
print(best)


(n, m) = map(int, input().split())
cnt = [0] * 101
for el in input().split():
	el = int(el)
	cnt[el] += 1
l = 0
r = int(1000000000.0)
cnt.sort()
while r - l > 1:
	med = l + (r - l) // 2
	cc = 0
	for i in range(0, 101):
		cc += cnt[i] // med
	if cc >= n:
		l = med
	else:
		r = med
cc = 0
for i in range(0, 101):
	cc += cnt[i] // r
if cc >= n:
	print(r)
else:
	print(l)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in a:
	try:
		d[i] += 1
	except KeyError:
		d[i] = 1
mx = m // n
while mx != 0:
	cur = 0
	for i in d:
		t = d[i] // mx
		cur += t
	if cur >= n:
		break
	else:
		mx -= 1
print(mx)


from collections import *
from math import *
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = Counter(a)
ct = [0 for i in range(101)]
for i in a.keys():
	for j in range(a[i], 0, -1):
		ct[j] += a[i] // j
ans = 0
for i in range(100, -1, -1):
	if ct[i] >= n:
		ans = i
		break
print(ans)


from collections import *
rd = lambda : map(int, input().split())
(n, m) = rd()
a = Counter(rd())
r = 1
while sum((a[x] // r for x in a)) >= n:
	r += 1
print(r - 1)


(n, k) = map(int, input().split())
mas = list(map(int, input().split()))
f = set(mas)
gas = []
for el in f:
	gas.append(mas.count(el))
gas.sort()
d = max(gas)
for d in range(k, 0, -1):
	m = 0
	for el in gas:
		m += el // d
	if m >= n:
		print(d)
		exit(0)
print(0)


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr
from bisect import bisect_left as bl, bisect_right as br

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binarytodecimal(n):
	return int(n, 2)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y

def di():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
(n, m) = di()
a = li()
dic = get_frequency(a)
ll = list(dic.values())
maxpeople = 0
for days in range(1, 107):
	no_of_people = 0
	for food_packets in range(len(ll)):
		no_of_people += ll[food_packets] // days
	if no_of_people < n:
		break
print(days - 1)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
from collections import defaultdict
count = defaultdict(int)
for i in a:
	count[i] += 1
for d in range(100, 0, -1):
	p = 0
	c = count.copy()
	for i in range(1, 101):
		p += c[i] // d
	if p >= n:
		print(d)
		exit()
print(0)


(n, m) = list(map(int, input().split()))
linp = list(map(int, input().split()))
l = [0] * 101
for i in linp:
	l[i] += 1
test = 100
while test > 0:
	l2 = [i // test for i in l]
	peop = sum(l2)
	if peop >= n:
		break
	else:
		test -= 1
print(test)


def scanf(obj=list, type=int, sep=' '):
	return obj(map(type, input().split(sep)))
(n, m) = scanf()
v = scanf()
t = [0] * 101
for x in v:
	t[x] += 1
for i in range(100, 0, -1):
	if sum([x // i for x in t]) >= n:
		print(i)
		break
else:
	print(0)


def Check(days):
	global n, m, x
	pe = 0
	for i in range(len(x)):
		pe += x[i] // days
	if pe >= n:
		return True
	else:
		return False
(n, m) = map(int, input().split())
a = [*map(int, input().split())]
x = []
b = dict()
for i in a:
	b[i] = b.get(i, 0) + 1
for i in b.values():
	x.append(i)
(left, right) = (0, 100)
while left < right:
	mid = (left + right + 1) // 2
	if Check(mid):
		left = mid
	else:
		right = mid - 1
print(left)


from collections import Counter
(n, m) = list(map(int, input().split()))
foodtype = list(map(int, input().split()))
count = dict(Counter(foodtype))
d = 1
ans = 0
while d:
	temp = 0
	for i in count.values():
		temp += i // d
	if temp >= n:
		ans = d
	else:
		break
	d += 1
print(ans)


from collections import defaultdict

def planning_the_expedition():
	limit = 100
	(n, m) = map(int, input().split())
	food_types = [int(k) for k in input().split()]
	if m < n:
		return 0
	food_count = defaultdict(int)
	for f in food_types:
		food_count[f] += 1
	for day in range(limit, 0, -1):
		fc = food_count.copy()
		k = 0
		for f_type in fc.keys():
			while fc[f_type] >= day:
				fc[f_type] -= day
				k += 1
		if k >= n:
			return day
	return 0
print(planning_the_expedition())


from collections import Counter
(m, n) = map(int, input().split())
r = Counter(list(map(int, input().split()))).values()
i = 1
while sum((x // i for x in r)) >= m:
	i += 1
print(i - 1)


n_m = input()
n_m = n_m.split(' ')
n_m = list(map(int, n_m))
n = n_m[0]
m = n_m[1]
foods = input()
foods = foods.split(' ')
foods = list(map(int, foods))
foods = sorted(foods, reverse=True)
foods_count = []
temp = 1
for i in range(0, len(foods) - 1):
	if foods[i] == foods[i + 1]:
		temp = temp + 1
	else:
		foods_count.append(temp)
		temp = 1
foods_count.append(temp)
foods_count = sorted(foods_count, reverse=True)
divisor = 1
result = 0
status = 0
while status == 0:
	result = 0
	for j in range(0, len(foods_count)):
		result = result + foods_count[j] // divisor
	if result < n:
		status = status + 1
	else:
		divisor = divisor + 1
print(divisor - 1)


(n, m) = map(int, input().split())
l = [int(x) for x in input().split()]
dict = {}
for x in l:
	try:
		dict[x] = dict[x] + 1
	except:
		dict[x] = 1
for i in range(1, 110):
	t = 0
	for k in dict:
		t += dict[k] // i
	if t < n:
		print(i - 1)
		break


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
if m < n:
	print(0)
else:
	count = 0
	idx = m // n
	flag = True
	enum = {}
	res = 0
	for i in arr:
		try:
			enum[i] += 1
		except:
			enum[i] = 1
	distinct = len(enum)
	val = [i for i in list(enum.values())]
	val.sort()
	for i in range(idx, 0, -1):
		res = 0
		for j in val:
			res += j // i
		if res >= n:
			print(i)
			flag = False
			break
	if flag:
		print(0)


import collections as cc
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
ff = cc.Counter(l)
ff = dict(ff)
i = 1
ans = 0
while i:
	temp = 0
	for j in ff.values():
		temp += j // i
	if temp >= n:
		ans = i
	else:
		break
	i += 1
print(ans)


from sys import stdin
from math import *
line = stdin.readline().rstrip().split()
n = int(line[0])
m = int(line[1])
nums = list(map(int, stdin.readline().rstrip().split()))
foodCant = [0] * 100
foodPeople = [0] * 100
for num in nums:
	foodCant[num - 1] += 1
for i in range(n):
	maxRest = 0
	minRange = 0
	for j in range(100):
		if int(floor(foodCant[j] / (foodPeople[j] + 1))) > maxRest:
			maxRest = int(floor(foodCant[j] / (foodPeople[j] + 1)))
			minRange = j
	foodPeople[minRange] += 1
minFood = 1000
for j in range(100):
	if foodPeople[j] > 0 and int(floor(foodCant[j] / foodPeople[j])) < minFood:
		minFood = int(floor(foodCant[j] / foodPeople[j]))
if minFood == 1000:
	print(0)
else:
	print(minFood)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = []
for i in set(a):
	b.append(a.count(i))
b.sort(reverse=True)
r = 0
for i in range(1, 101):
	x = 0
	for j in b:
		x += j // i
		if x >= n:
			break
	if x >= n:
		r = max(r, i)
	else:
		break
print(r)


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
from collections import deque as dq
ans = 0
(low, high) = (0, 101)
(n, m) = iia()
arr = iia()
arr = Counter(arr)

def ok(val):
	ans = 0
	if val == 0:
		return True
	for i in arr.values():
		ans += floor(i / val)
	return ans >= n
while low <= high:
	mid = low + high >> 1
	if ok(mid):
		ans = mid
		low = mid + 1
	else:
		high = mid - 1
print(ans)


def bs(mid, a, z):
	if sum((i // mid for i in z)) >= a:
		return 1
	return 0
(a, b) = map(int, input().split())
z1 = dict()
for i in map(int, input().split()):
	z1[i] = z1.get(i, 0) + 1
z = list(z1.values())
lo = 1
hi = 100
ans = 0
while lo <= hi:
	mid = lo + (hi - lo) // 2
	if bs(mid, a, z):
		ans = mid
		lo = mid + 1
	else:
		hi = mid - 1
print(ans)


def main():
	(n, m) = map(int, input().split())
	food = list(map(int, input().split()))
	arr = dict()
	for i in food:
		if i not in arr:
			arr[i] = 1
		else:
			arr[i] += 1
	maxD = 0
	for d in range(1, 101, 1):
		temp = arr
		k = 0
		flag = 0
		for (key, val) in temp.items():
			while val >= d:
				flag += 1
				k += 1
				val -= d
		if k >= n and d > maxD:
			maxD = d
		if flag == 0:
			break
	print(maxD)
main()


from collections import Counter
I = lambda : map(int, input().split())
(n, _) = I()
V = Counter(I()).values()
d = 1
while sum((v // d for v in V)) >= n:
	d += 1
print(d - 1)


(n, m) = map(int, input().split())
a = map(int, input().split())
counts = {}
for i in a:
	counts[i] = counts.setdefault(i, 0) + 1
l = 0
r = m // n
while l < r:
	m = (l + r + 1) // 2
	s = 0
	for v in counts.values():
		s += v // m
	if s >= n:
		l = m
	else:
		r = m - 1
print(l)


from collections import Counter
(n, m) = list(map(int, input().split()))
l = list(map(int, input().split()))
l2 = [y for (x, y) in Counter(l).items()]
l2.sort(reverse=True)
for i in range(1, max(l2) + 2):
	if sum((int(x / i) for x in l2)) < n:
		print(i - 1)
		break
else:
	print()


from collections import defaultdict as dd, deque
(n, m) = map(int, input().split())
A = [int(x) for x in input().split()]
C = dd(int)
for a in A:
	C[a] += 1
psize = 1
while True:
	packs = 0
	for c in C:
		packs += C[c] // psize
	if packs < n:
		break
	psize += 1
print(psize - 1)


(n, m) = map(int, input().split())
c = [0 for i in range(110)]
for el in input().split():
	c[int(el)] += 1
ans = 100
for i in range(100, 0, -1):
	t = n
	for j in range(1, 102):
		t -= c[j] // i
	if t <= 0:
		print(i)
		exit(0)
print(0)


(n, m) = map(int, input().split())
d_max = m // n
a = [0] * 100
for x in input().split():
	a[int(x) - 1] += 1
b = sorted(range(100), key=lambda x: a[x], reverse=True)
ans = 0
for d in range(1, d_max + 1):
	used = 0
	for i in range(100):
		used += a[b[i]] // d
		if used >= n:
			ans = d
			break
print(ans)