#include <bits/stdc++.h>
using namespace std;
int f[1005];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int x;
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &x);
    f[x]++;
  }
  int ans = m;
  for (int i = 1; i <= n; ++i) ans = min(ans, f[i]);
  printf("%d\n", ans);
}
