<!-- wp:code -->
<pre class="wp-block-code"><code>#include &lt;iostream>

using namespace std;

int main(){
    int i,n,place;    
    cin >> n >> place;
    int scores&#91;n];
    int count =0;
     for(i=1;i&lt;=n;i++){
        cin >> scores&#91;i];
        if(scores&#91;i]!=0){
            if(i&lt;=place)
                count++;
            else if(scores&#91;i]==scores&#91;place]){
                count++;
            }
        }
    }
   
    cout &lt;&lt; count;
    return 0;
}</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>Question :</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">A. Next Round</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"right"} -->
<p class="has-text-align-right">time limit per test :3 seconds<br>memory limit per test: 256 megabytes<br>input/output : standard input / standard output</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>"Contestant who earns a score equal to or greater than the&nbsp;<em>k</em>-th place finisher's score will advance to the next round, as long as the contestant earns a positive score..." — an excerpt from contest rules.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A total of&nbsp;<em>n</em>&nbsp;participants took part in the contest (<em>n</em> ≥ <em>k</em>), and you already know their scores. Calculate how many participants will advance to the next round.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Input</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The first line of the input contains two integers&nbsp;<em>n</em>&nbsp;and&nbsp;<em>k</em>&nbsp;(1 ≤ <em>k</em> ≤ <em>n</em> ≤ 50) separated by a single space.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The second line contains&nbsp;<em>n</em>&nbsp;space-separated integers&nbsp;<em>a</em><sub>1</sub>, <em>a</em><sub>2</sub>, ..., <em>a</em><sub><em>n</em></sub>&nbsp;(0 ≤ <em>a</em><sub><em>i</em></sub> ≤ 100), where&nbsp;<em>a</em><sub><em>i</em></sub>&nbsp;is the score earned by the participant who got the&nbsp;<em>i</em>-th place. The given sequence is non-increasing (that is, for all&nbsp;<em>i</em>&nbsp;from&nbsp;1&nbsp;to&nbsp;<em>n</em> - 1&nbsp;the following condition is fulfilled:&nbsp;<em>a</em><sub><em>i</em></sub> ≥ <em>a</em><sub><em>i</em> + 1</sub>).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Output</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Output the number of participants who advance to the next round.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Examples</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>input</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>8 5<br>10 9 8 7 7 7 5 5</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>output</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>6</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>input</p>
<!-- /wp:paragraph -->

<!-- wp:preformatted -->
<pre id="id0024340836637848717" class="wp-block-preformatted">4 2<br>0 0 0 0</pre>
<!-- /wp:preformatted -->

<!-- wp:paragraph -->
<p>output</p>
<!-- /wp:paragraph -->

<!-- wp:preformatted -->
<pre id="id009129598474756431" class="wp-block-preformatted">0</pre>
<!-- /wp:preformatted -->

<!-- wp:paragraph -->
<p><strong>Note</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In the first example the participant on the 5th place earned 7 points. As the participant on the 6th place also earned 7 points, there are 6 advancers.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In the second example nobody got a positive score.</p>
<!-- /wp:paragraph -->