#!/usr/bin/env python3 import sys def main(): import bisect # N = int(input()) N, K = map(int,input().split()) P = list(map(int,input().split())) P.sort() for B in range(400): num = N - bisect.bisect_left(P, B) # print(B, num, bisect.bisect_left(P, B)) if num <= K: print(num) return return if __name__ == '__main__': main()