#include <bits/stdc++.h>
int n, m, c[1005], a[1005], score;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &c[i]);
    a[c[i] - 1]++;
    score = m;
    for (int j = 0; j < n; j++) {
      if (score > a[j]) {
        score = a[j];
      }
    }
  }
  printf("%d\n", score);
  return 0;
}
