#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, c;
  int a[2000];
  int d = 0;
  scanf("%d%d", &n, &k);
  memset(a, 0, sizeof(a));
  for (int i = 0; i < k; i++) {
    scanf("%d", &c);
    if (a[c] == 0) d++;
    a[c]++;
  }
  if (d != n) {
    printf("0\n");
    return 0;
  }
  sort(a, a + n + 1);
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0)
      continue;
    else {
      printf("%d\n", a[i]);
      break;
    }
  }
}
