水
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _158A
{
class Program
{
static void Main(string[] args)
{
int[] arr = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
int n = arr[0];
int k = arr[1] - 1;
int[] score = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
if (score[k] > 0)
{
int s = score[k];
while(k < n && score[k] == s)
{
k++;
}
}
else
{
while(k >= 0 && score[k] <= 0)
{
k--;
}
k++;
}
Console.WriteLine(k);
}
}
}