a=list(map(int,input().split()))
b=list(map(int,input().split()))
yo=0

for i in range(len(b)):
	if b[i]==0:
	
		yo +=1
		
flag=0
for c in range (len(b)):
	if yo!=len(b):
		if b[a[1]-1]!=0:
			if b[c]>=b[a[1]-1]:
				flag+=1
			else:
				continue
		else:
			if b[c]>b[a[1]-1]:
				flag+=1
			else:
				continue		
	 
	else:
		break		
print(flag)			

6e2e386c256c0159764c5a607c48733ef3628dec
<mask token>

<mask token>
for i in range(len(b)):
    if b[i] == 0:
        yo += 1
<mask token>
for c in range(len(b)):
    if yo != len(b):
        if b[a[1] - 1] != 0:
            if b[c] >= b[a[1] - 1]:
                flag += 1
            else:
                continue
        elif b[c] > b[a[1] - 1]:
            flag += 1
        else:
            continue
    else:
        break
print(flag)

a = list(map(int, input().split()))
b = list(map(int, input().split()))
yo = 0
for i in range(len(b)):
    if b[i] == 0:
        yo += 1
flag = 0
for c in range(len(b)):
    if yo != len(b):
        if b[a[1] - 1] != 0:
            if b[c] >= b[a[1] - 1]:
                flag += 1
            else:
                continue
        elif b[c] > b[a[1] - 1]:
            flag += 1
        else:
            continue
    else:
        break
print(flag)

a=list(map(int,input().split()))
b=list(map(int,input().split()))
yo=0

for i in range(len(b)):
	if b[i]==0:
	
		yo +=1
		
flag=0
for c in range (len(b)):
	if yo!=len(b):
		if b[a[1]-1]!=0:
			if b[c]>=b[a[1]-1]:
				flag+=1
			else:
				continue
		else:
			if b[c]>b[a[1]-1]:
				flag+=1
			else:
				continue		
	 
	else:
		break		
print(flag)			
