#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) { return a.second > b.second; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  unordered_map<int, int> mp;
  int n, m;
  cin >> n >> m;
  int arr[m];
  for (int i = 0; i < m; i++) {
    cin >> arr[i];
    mp[arr[i]]++;
  }
  vector<pair<int, int>> v(mp.begin(), mp.end());
  sort(v.begin(), v.end(), cmp);
  int cnt = 1;
  while (1) {
    int nm = n;
    int ok = 0;
    for (int i = 0; i < v.size(); i++) {
      int number = v[i].second;
      while (nm > 0 && number >= cnt) {
        number -= cnt;
        nm--;
      }
      if (nm == 0) {
        ok = 1;
      }
    }
    if (ok) {
      cnt++;
    } else {
      break;
    }
  }
  cout << cnt - 1 << '\n';
}
