Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Prap

Problemset: พอด

Language: cpp

Time: 0.021 second

Submitted On: 2026-03-25 13:58:05

#include <iostream>
#include <cmath>
#include <vector>
#include <string>
using namespace std;
int main() {
	int K,N;
	cin>>N>>K;
	int pod[K] = {0};
	for (int i = 0; i<N; i++) {
		int hol;
		cin>>hol;
		pod[hol-1]++;
		int count = 0;
		for (int j = 0; j < K; j++) {
			if (pod[j] != 0) {
				count++;
			}
		}
		if (count == K) {
			for (int j = 0; j < K; j++) {
				pod[j]--;
			}
		}
	}
	int count = 0;
	for (int i = 0; i<K; i++) {
		count = count + pod[i];
	}
	cout<<count;
}