#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 17;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
int cnt[1050];
int main() {
  int N, M, i, j;
  scanf("%d %d", &N, &M);
  for (i = 1; i <= M; i++) {
    scanf("%d", &j);
    cnt[j]++;
  }
  int mn = INF;
  for (i = 1; i <= N; i++) mn = min(mn, cnt[i]);
  return !printf("%d\n", mn);
}
