package yukicoder; import java.util.Scanner; public class Main{ public static void main(String[] args){ new Main().solve(); } void solve(){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int k=sc.nextInt(); FenwickTree ft=new FenwickTree(1_000_000); for(int i = 0; i < n; i++){ int w=sc.nextInt(); if(w>0){ if(ft.sum(w, 1_000_000)>=k)continue; else{ ft.add(w, 1); } }else if(w<0){ if(ft.sum(-w, -w)>0){ ft.add(-w, -1); } } } System.out.println(ft.sum(1_000_000)); } class FenwickTree{ int[] bit; int n; public FenwickTree(int n){ this.n = n; bit = new int[n + 1]; } //xにiを加える。 void add(int i, int x) { while(i <= n){ bit[i] += x; i += i & -i; } } //iまでの和を求める。 int sum(int i) { int sum = 0; while(i > 0){ sum += bit[i]; i -= i & -i; } return sum; } int sum(int l, int r) { return sum(r) - sum(l - 1); } } }