#include <bits/stdc++.h>
using namespace std;
int N, M, aux, ans;
int cub[1005];
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> N >> M;
  while (M--) {
    cin >> aux;
    cub[aux]++;
  }
  ans = cub[1];
  for (int i = 2; i <= N; i++) ans = min(ans, cub[i]);
  cout << ans << "\n";
  return 0;
}
