#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 + 10;
int a[maxn];
int b[maxn];
int temp;
int main() {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  int maxh = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d", &temp);
    b[temp]++;
    maxh = max(maxh, b[temp]);
  }
  int ans = 100000;
  for (int i = 1; i <= n; i++) {
    ans = min(ans, b[i]);
  }
  cout << ans << endl;
  return 0;
}
