#include <bits/stdc++.h>
using namespace std;
long long vis[1000000];
signed main() {
  long long n, m;
  cin >> n >> m;
  long long maxn = 0;
  long long minx = 1000000090;
  for (long long i = 0; i < m; i++) {
    long long t;
    cin >> t;
    minx = min(minx, t);
    maxn = max(maxn, t);
    vis[t]++;
  }
  long long ans = 1000000090;
  for (long long i = 1; i <= n; i++) {
    ans = min(ans, vis[i]);
  }
  cout << ans;
  return 0;
}
