#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    a[i] = 0;
  }
  long long int x;
  for (long long int i = 0; i < m; i++) {
    cin >> x;
    a[x - 1] += 1;
  }
  long long int min = (m > n) ? m : n;
  for (long long int i = 0; i < n; i++) {
    if (a[i] < min) min = a[i];
  }
  cout << min << endl;
  return 0;
}
