from bisect import bisect_left, bisect_right from math import inf from typing import NamedTuple class Frog(NamedTuple): coord: int amp: int def is_range(self, start: int, end: int) -> bool: return start <= self.coord <= end @property def range(self) -> tuple[int, int]: return self.coord-self.amp, self.coord+self.amp def main(): N, K = map(int, input().split()) X = list(map(int, input().split())) A = list(map(int, input().split())) frogs: list[Frog] = [Frog(coord, amp) for coord, amp in zip(X, A)] left_effect = X[K-1]-A[K-1] right_effect = X[K-1]+A[K-1] left_idx = K-1 right_idx = K idx_changed = True while idx_changed: new_gelo: list[Frog] = [] idx_changed = False left_idx_candidate = bisect_left(X, left_effect) right_idx_candidate = bisect_right(X, right_effect) if left_idx != left_idx_candidate: idx_changed = True new_gelo.extend(frogs[left_idx_candidate:left_idx]) left_idx = left_idx_candidate if right_idx != right_idx_candidate: idx_changed = True new_gelo.extend(frogs[right_idx:right_idx_candidate]) right_idx = right_idx_candidate for frog in new_gelo: left_range, right_range = frog.range left_effect = min(left_effect, left_range) right_effect = max(right_effect, right_range) print(right_idx - left_idx) if __name__ == "__main__": main()