#include <bits/stdc++.h>
using namespace std;
int a[1001];
signed main() {
  int n, m;
  cin >> n >> m;
  int col;
  int mn = 0;
  while (m--) {
    cin >> col;
    a[col]++;
    mn = max(mn, a[col]);
  }
  for (int i = 1; i <= n; i++) {
    mn = min(mn, a[i]);
  }
  cout << mn;
}
