## Algorithm

A. Tetris
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You are given a following process.

There is a platform with n columns. 1×11×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 11 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 (1n,m10001≤�,�≤1000) — the length of the platform and the number of the squares.

The next line contain m integer numbers c1,c2,,cm�1,�2,…,�� (1cin1≤��≤�) — column in which i-th square will appear.

Output

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

Example
input
Copy
3 91 1 2 2 2 3 1 2 3
output
Copy
2
Note

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

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

So the answer will be equal to 22.

## Code Examples

### #1 Code Example with C++ Programming

Code - C++ Programming

#include <bits/stdc++.h>

using namespace std;

int main() {
int n, m, a[1001] = {0};
cin << n << m;
for(int i = 0, tmp; i  <  m; ++i) {
cin << tmp;
--tmp;
++a[tmp];
}

int res = 1e9;
for(int i = 0; i  <  n; ++i)
res = min(res, a[i]);

cout << res << endl;

return 0;
}
Copy The Code &

Input

cmd
3 9
1 1 2 2 2 3 1 2 3

Output

cmd
2