#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  vector<int> arr(m);
  map<int, int> ma;
  for (auto &a : arr) scanf("%d", &a);
  if (n > m) {
    printf("0\n");
    return 0;
  }
  for (auto &a : arr) ma[a]++;
  vector<int> count_sort;
  for (auto el : ma) count_sort.push_back(el.second);
  sort(count_sort.begin(), count_sort.end());
  reverse(count_sort.begin(), count_sort.end());
  for (int i = m; i >= 1; i--) {
    int how_many_people = 0;
    for (auto c : count_sort) how_many_people += (c / i);
    if (how_many_people >= n) {
      cout << i << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  return 0;
}
