#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int val, mx = INT_MIN;
  map<int, int> mp;
  for (int i = 0; i < m; i++) {
    cin >> val;
    val--;
    mp[val]++;
  }
  int ans = INT_MAX;
  for (int i = 0; i < n; i++) {
    ans = min(ans, mp[i]);
  }
  cout << ans << '\n';
  return 0;
}
