#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n, m, x;
  stack<int> s[1005];
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    s[x].push(1);
  }
  int Min = 1000000;
  for (int i = 1; i <= n; i++) {
    if (Min > s[i].size()) Min = s[i].size();
  }
  cout << Min << endl;
  return 0;
}
