n, k = map(int, input().split()) X = list(map(int, input().split())) A = list(map(int, input().split())) X.sort() k -= 1 l = k r = k ld = X[k]-A[k] rd = X[k]+A[k] flag = True while flag: flag = False while l-1 >= 0 and ld <= X[l-1]: flag = True l -= 1 ld = min(ld, X[l]-A[l]) rd = max(rd, X[l]+A[l]) while r+1 <= n-1 and X[r+1] <= rd: flag = True r += 1 rd = max(rd, X[r]+A[r]) ld = min(ld, X[r]+A[r]) print(r-l+1)