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