#include <bits/stdc++.h>
using namespace std;
long long int binomialCoeff(long long int n, long long int k) {
  long long int C[n + 1][k + 1];
  long long int i, j;
  for (i = 0; i <= n; i++) {
    for (j = 0; j <= min(i, k); j++) {
      if (j == 0 || j == i)
        C[i][j] = 1;
      else
        C[i][j] = (C[i - 1][j - 1] % 1000000007 + C[i - 1][j] % 1000000007) %
                  1000000007;
    }
    C[i][j] = C[i][j] % 1000000007;
  }
  return C[n][k] % 1000000007;
}
long long int power(long long int base, long long int exp) {
  long long int res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    exp /= 2;
  }
  return res % 1000000007;
}
void chatur() {
  long long int n, i = 0, j, k = 0, q, l, r, x, y, t = 0, g = 0, c = 0;
  cin >> n >> k;
  map<long long int, long long int> m;
  long long int a[k];
  for (i = 0; i < k; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  for (i = 1; i <= n; i++) {
    k = min(k, m[i]);
  }
  cout << k;
}
int main() {
  int t = 1;
  while (t--) {
    chatur();
  }
}
