#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int cnt[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  while (m--) {
    int x;
    cin >> x;
    cnt[x]++;
  }
  int mn = 1e9;
  for (auto i = 1; i <= (long long)(n); i++) mn = min(mn, cnt[i]);
  cout << mn << '\n';
  return 0;
}
