You are given a following process. 

There is a platform with $n$ columns. $1 \times 1$ squares are appearing one after another in some columns on this platform. If there are no squares in the column, a square will occupy the bottom row. Otherwise a square will appear at the top of the highest square of this column. 

When all of the $n$ columns have at least one square in them, the bottom row is being removed. You will receive $1$ point for this, and all the squares left will fall down one row. 

You task is to calculate the amount of points you will receive.


-----Input-----

The first line of input contain 2 integer numbers $n$ and $m$ ($1 \le n, m \le 1000$) — the length of the platform and the number of the squares.

The next line contain $m$ integer numbers $c_1, c_2, \dots, c_m$ ($1 \le c_i \le n$) — column in which $i$-th square will appear.


-----Output-----

Print one integer — the amount of points you will receive.


-----Example-----
Input
3 9
1 1 2 2 2 3 1 2 3

Output
2



-----Note-----

In the sample case the answer will be equal to $2$ because after the appearing of $6$-th square will be removed one row (counts of the squares on the platform will look like $[2~ 3~ 1]$, and after removing one row will be $[1~ 2~ 0]$).

After the appearing of $9$-th square counts will be $[2~ 3~ 1]$, and after removing one row it will look like $[1~ 2~ 0]$.

So the answer will be equal to $2$.

Difficulty: interview

Starter code:

Solutions:
n,m = map(int,input().split())
res = [0] * n
a = list(map(int,input().split()))
for i in a:
    res[i - 1] += 1
print(min(res))

n, m = map(int, input().split())
c = [0] * n
s = list(map(int, input().split()))
for sq in s:
    c[sq - 1] += 1
print(min(c))

from collections import defaultdict
n, m = list(map(int, input().split()))
cnt = defaultdict(int)
for el in list(map(int, input().split())):
    cnt[el] += 1

res = float('inf')
for i in range(1, n+1):
    res = min(res, cnt[i])
print(res)


def li():
    return list(map(int, input().split()))
n, m = li()
a = li()
aa = [0] * n
for b in a:
    aa[b - 1] += 1
print(min(aa))


from collections import defaultdict as dd, deque

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

for c in map(int,input().split()):
    H[c-1] += 1

print(min(H))


n, m = [int(i) for i in input().split()]
a = [0] * (n + 1)
b = [int(i) for i in input().split()]
for i in b:
    a[i] += 1
print(min(a[1:n+1]))


n, m = map(int, input().split())
num = [0] * n
smth = list(map(int, input().split()))
for i in range(m):
    num[smth[i] - 1] += 1
print(min(num))

(n, m) = list(map(int, input().split()))

lst = []
for x in input().split():
    lst.append(int(x))

array = [0] * n

for x in range(len(lst)):
    array[lst[x] - 1] += 1

print(min(array))


from sys import stdin, stdout
from random import randrange

sze = 10 ** 3 + 10
n, m = map(int, stdin.readline().split())
values = list(map(int, stdin.readline().split()))
cnt = [0 for i in range(sze)]
INF = float('inf')
ans = 0

for v in values:
    cnt[v] += 1
    mn = INF
    
    for i in range(1, n + 1):
        mn = min(mn, cnt[i])
    
    ans += mn
    
    for i in range(1, n + 1):
        cnt[i] -= mn

stdout.write(str(ans))

n, m = list(map(int, input().split()))
l = list(map(int, input().split()))
mas = []
for i in range(n):
    mas.append(0)
for i in l:
    mas[i - 1] += 1
print(min(mas))


import atexit
import io
import sys

# Buffering IO
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
    

def main():
    n, m = [int(x) for x in input().split()]
    c = [int(x) for x in input().split()]
    print(min(c.count(x) for x in range(1, n+1)))
    
def __starting_point():
    main()

__starting_point()

# ===================================
# (c) MidAndFeed aka ASilentVoice
# ===================================
# import math, fractions, collections
# ===================================
n, m = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
ans = 1e9
for i in range(1, n+1):
	s = q.count(i)
	ans = min(ans, s)
print(ans)

n, m = map(int, input().split())
a = [0] * n
for i in map(int, input().split()):
	a[i-1] += 1
print(min(a))

n,m=list(map(int,input().split()))
pts=[0 for i in range(n)]
a=list(map(int,input().split()))
for i in range(m):
    x=a[i]-1
    pts[x]+=1
print(min(pts))






n, m = list(map(int, input().strip().split()))
arr = list(map(int, input().strip().split()))
rslt = [0]*n
for x in arr:
    rslt[x-1] += 1
print(min(rslt))


n,m=list(map(int,input().split()))
inp=list(map(int,input().split()))
L=[0]*n
for i in inp:
    L[i-1]+=1
print(min(L))


n, m = (int(x) for x in input().split())

a = [int(x) for x in input().split()]

b = [0] * n
for i in range(m):
    b[a[i] - 1] += 1
print(min(b))


n,m = list(map(int,input().split()))
a = [0]*n
for i in list(map(int,input().split())):a[i-1] += 1
print(min(a))


n, m = list(map(int, input().split()))
arr = [0 for i in range(n)]
sq = list(map(int, input().split()))
for c in sq: arr[c - 1] += 1
print(min(arr))


(n, m) = (int(i) for i in input().split())
tab = [0] * n
for i in [int(j) for j in input().split()]:
	tab[i-1] += 1
print(min(tab))


n, m =[int(x) for x in input().split()]
d = [0] * n
inp =[int(x) - 1 for x in input().split()] 
for i in range(m):
    d[inp[i]] += 1
print(min(d)) 

t = input().split(' ')
n = int(t[0])
m = int(t[1])
M = [0] * (n+1)
s = input().split(' ')
for i in s:
    M[int(i)] += 1
sol = M[1]
for j in range(2, len(M)):
    if M[j] < sol:
        sol = M[j]
print(sol)


n, m = map(int, input().split())
c = list(map(int, input().split()))
cnt = [0] * n
for x in c:
    cnt[x - 1] += 1

print(min(cnt))

s = input().split()
n = int(s[0])
m = int(s[1])
s = list(map(int, input().split()))
dic = {}
for i in range(n):
    dic.update({i+1:0})
for x in s:
    dic[x]+=1

mn = 10**9
for x in dic.keys():
    if dic[x]<mn:
        mn = dic[x]

print(mn)


import collections
n, m = map(int,input().split())
a = collections.Counter(list(map(int,input().split())))
if len(a)<n:
	print (0)
else:
	print (min(a.values()))