#include <bits/stdc++.h>
using namespace std;
void initialize(bool needFiles) {
  if (needFiles) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  }
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
int main() {
  initialize(false);
  int n, m;
  cin >> n >> m;
  unsigned int a[n];
  for (int i = 0; i < n; ++i) {
    a[i] = 0;
  }
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    a[x - 1]++;
  }
  unsigned int mina = 1000000022;
  for (int j = 0; j < n; ++j) {
    if (a[j] < mina) mina = a[j];
  }
  cout << mina;
  return 0;
}
