Note
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.
In the second example nobody got a positive score.
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
int count=0;
int[] score = new int[60];
for(int i=0;i<n;i++)
score[i]=sc.nextInt();
int max=score[k⑴];
for(int i=0;i<n;i++)
if(score[i]>=max&&score[i]>0)
count++;
System.out.println(count);
}
}