#include <bits/stdc++.h>
using namespace std;
template <class T>
void smin(T& a, T val) {
  if (a > val) a = val;
}
template <class T>
void smax(T& a, T val) {
  if (a < val) a = val;
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  bool first = true;
  os << "[";
  for (auto i : v) {
    if (!first) os << ", ";
    os << i;
    first = false;
  }
  return os << "]";
}
const int MAX = 100010;
int a[MAX], n, m, cnt[MAX];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int ans = INT_MAX;
  for (int i = 1; i <= n; ++i) {
    smin(ans, cnt[i]);
  }
  cout << ans;
  return 0;
}
