import java.io.*;
import java.util.*;

public class A {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputReader in = new InputReader(System.in);

        int n = in.nextInt();
        int d = in.nextInt();

        ArrayList<Integer> arr = new ArrayList<>();

        for(int i = 0; i < n; i++) {
            arr.add(i);
        }

        Collections.sort(arr);

        int max = 0;
        for(int i = 0; i < n; i++) {
            int temp = 1;
            for(int y = i + 1; y < n; y++) {
                if(arr.get(y) - arr.get(i) <= d) {
                    temp++;
                } else {
                    break;
                }
            }
            max = Math.max(max, temp);
        }

        out.print(n - max);
        out.close();
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}
