#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
using ll = long long;
using ull = unsigned long long;
using ld = long double;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> v(n, 0);
  int c;
  for (int i = 0; i < m; i++) {
    cin >> c;
    v[c - 1]++;
  }
  int ans = INF;
  for (int i : v) {
    ans = min(ans, i);
  }
  cout << ans;
  return 0;
}
