#include <bits/stdc++.h>
using namespace std;
const int oo = (int)1e9 + 7;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> v(n + 1);
  for (int i = 0; i < m; ++i) {
    int x;
    scanf("%d", &x);
    v[x]++;
  }
  int ans = 0;
  while (true) {
    bool ok = true;
    for (int i = 1; i <= n; ++i) {
      if (!v[i]) {
        ok = false;
        break;
      }
      v[i]--;
    }
    if (ok)
      ++ans;
    else
      break;
  }
  printf("%d", ans);
  cin.ignore();
  cin.get();
}
