#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[m];
  for (int i = 0; i < m; i++) cin >> arr[i];
  int height[n];
  for (int i = 0; i < n; i++) {
    height[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    height[arr[i] - 1]++;
  }
  int min = INT_MAX;
  for (int i = 0; i < n; i++) {
    if (height[i] < min) min = height[i];
  }
  cout << min;
  return 0;
}
