#include <bits/stdc++.h>
using namespace std;
int cn[2000];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int n, k, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
      int x;
      cin >> x;
      cn[x]++;
    }
    int val = 3000;
    for (int i = 1; i <= n; i++) {
      val = min(val, cn[i]);
    }
    cout << val;
  }
}
