#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, mx = 10000000, x;
  map<int, int> mp;
  cin >> n >> m;
  while (m--) {
    cin >> x;
    mp[x]++;
  }
  for (auto &it : mp) mx = min(mx, it.second);
  if (mp.size() < n) mx = 0;
  cout << mx << endl;
  return 0;
}
