import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.*; public class a { public static void main(String[] args) throws FileNotFoundException { Scanner scn = new Scanner(new File("paint.in")); int N = scn.nextInt(); int K = scn.nextInt(); TreeMap positions = new TreeMap<>(); int curr_pos = 0; char dir = 'X'; for(int i=0;i= K) { ans += pos - prev; } curr += positions.get(pos); prev = pos; } PrintStream ps = new PrintStream("paint.out"); ps.println(ans); ps.close(); } }