#include <bits/stdc++.h>
long long m, n, t;
long long sum = 0;
const int ma = 3e5 + 5;
long long a[ma], b[ma];
using namespace std;
int main() {
  cin >> n >> m;
  for (long long int i = 0; i < m; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  int min = 1000000;
  for (long long int i = 1; i <= n; i++) {
    if (a[i] < min) min = a[i];
  }
  cout << min;
}
