#include <bits/stdc++.h>
using namespace std;
struct HEAP_CMP {
  bool operator()(long long a, long long b) { return a > b; }
};
const long long M = 2e6 + 7;
const long long mod = 1e9;
const long double esp = 1e-5;
int d[1005], ans = 10005, a, n, m;
void solve() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a;
    d[a]++;
  }
  for (int i = 1; i <= n; i++) ans = min(ans, d[i]);
  cout << ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  solve();
  return 0;
}
