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