#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, p = INT_MAX;
  cin >> n >> m;
  long long int flag[1000000], a[m];
  memset(flag, 0, sizeof(flag));
  for (i = 0; i < m; i++) {
    cin >> a[i];
    flag[a[i]]++;
  }
  for (i = 1; i <= n; i++) {
    if (flag[i] < p) p = flag[i];
  }
  cout << p << endl;
}
