Time Lapse :NONE 10775.cpp 1234567891011121314151617181920212223242526#include <iostream>#include <list>#include <map>#include <unordered_map>#include <vector>#include <stack>#include <unordered_set>#include <set>using namespace std;int g, p;int n, res(0);set<int> s;int main() { scanf("%d%d",&g,&p); for(int i = 1; i <= p; i++) s.insert(i); while(p--) { scanf("%d",&n); auto it = s.upper_bound(n); if(it == s.begin()) break; s.erase(prev(it)); res++; } cout<<res;}