#include using namespace std; int n, tmax; int t[10001]; bool check(int k) { priority_queue, greater > pq; for(int i=0; i 1) { pq.pop(); } return tmax >= pq.top(); } int main() { // freopen("cowdance.in","r",stdin); // freopen("cowdance.out","w",stdout); // ios::sync_with_stdio(false); cin.tie(0); cin>>n>>tmax; for(int i=0; i>t[i]; } int left = 1, right = n, ans = n; while(left<=right) { int mid = (left+right)/2; if(check(mid)) { ans = mid; right = mid - 1; } else { left = mid + 1; } } cout<