#include <bits/stdc++.h>
using namespace std;
int a[1004] = {0};
int main() {
  unsigned long long n, m, x, temp = 0;
  cin >> n >> m;
  if (n > m)
    cout << 0 << endl;
  else {
    for (int i = 1; i <= m; i++) {
      cin >> x;
      a[x]++;
    }
    temp = a[1];
    for (int i = 1; i <= n; i++)
      if (a[i] < temp) temp = a[i];
    cout << temp << endl;
  }
  return 0;
}
