#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int n, m, c[1005], val[1005], maxi = 1e9;
signed main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> c[i];
    val[c[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (maxi > val[i]) maxi = val[i];
  }
  cout << maxi;
}
