#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int MR = 1010;
int t[MR];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (m); ++i) {
    int c;
    scanf("%d", &c);
    c--;
    t[c]++;
  }
  int res = MR;
  for (int i = 0; i < (n); ++i) res = min(res, t[i]);
  printf("%d\n", res);
  return 0;
}
