import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.PriorityQueue; import java.util.Scanner; import java.util.Set; import java.util.Stack; import java.util.TreeMap; import java.util.TreeSet; import static java.util.Comparator.*; public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); Solver solver = new Solver(System.in, out); solver.solve(); out.close(); } } class Solver { Scanner sc; PrintWriter out; public Solver(InputStream in, PrintWriter out) { sc = new Scanner(in); this.out = out; } // ================================================================== TreeMap map = new TreeMap<>(); public void solve() { int N = Integer.parseInt(sc.next()); int K = Integer.parseInt(sc.next()) - 1; long[] X = new long[N]; long[] A = new long[N]; for (int i = 0; i < N; i++) { X[i] = Long.parseLong(sc.next()); } for (int i = 0; i < N; i++) { A[i] = Long.parseLong(sc.next()); } for (int i = 0; i < N; i++) { map.put(X[i], A[i]); } long min = X[K], svMin = min; long max = X[K], svMax = max; long lkey = X[K] - A[K] - 1; long rkey = X[K] + A[K] + 1; Entry low; Entry high; while(true) { // out.println("min = " + min + " lkey = " + lkey + " max = " + max + " rkey = " + rkey); low = map.higherEntry(lkey); high = map.lowerEntry(rkey); if(low != null) { // out.println(" low : X = " + low.getKey() + " A = " + low.getValue()); min = Math.min(min, low.getKey()); lkey = Math.min(lkey, low.getKey() - low.getValue() - 1); max = Math.max(max, low.getKey()); rkey = Math.max(rkey, low.getKey() + low.getValue() + 1); } if(high != null) { // out.println(" high : X = " + high.getKey() + " A = " + high.getValue()); min = Math.min(min, high.getKey()); lkey = Math.min(lkey, high.getKey() - high.getValue() - 1); max = Math.max(max, high.getKey()); rkey = Math.max(rkey, high.getKey() + high.getValue() + 1); } if(min == svMin && max == svMax) break; svMin = min; svMax = max; } int ans = 0; for (int i = 0; i < N; i++) { if(X[i] >= min && X[i] <= max) ans++; } out.println(ans); } class PP{ public int key, val; public PP(int key, int val) { this.key = key; this.val = val; } public int getKey() { return key; } public void setKey(int key) { this.key = key; } public int getVal() { return val; } public void setVal(int val) { this.val = val; } } }