#include <bits/stdc++.h>
using namespace std;
int a[1001];
int main() {
  int n, m, i, c, minim = 1000;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> c;
    a[c]++;
  }
  for (i = 1; i <= n; i++)
    if (a[i] == 0) {
      minim = 0;
      break;
    } else if (a[i] < minim)
      minim = a[i];
  cout << minim;
  return 0;
}
