#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, c, cnt = 0, mn, mnp = 10000000000;
  cin >> a >> b;
  vector<int> v;
  set<int> st;
  map<int, int> mp;
  for (int i = 0; i < b; i++) {
    cin >> c;
    v.push_back(c);
    mp[c]++;
    st.insert(c);
  }
  for (int j = 0; j < v.size(); j++) {
    if (mp[v[j]] < mnp) {
      mnp = mp[v[j]];
      mn = v[j];
    }
  }
  if (st.size() == a) {
    cout << mnp;
  } else {
    cout << 0;
  }
}
