import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;

public class Fixer {

	public static void main(String[] args) throws FileNotFoundException {
		was = new HashSet<Integer>();
		String inputName = args[0];
		Integer count = Integer.parseInt(args[1]);
		Scanner input = new Scanner(new File(inputName));
		String outputName = args[0] + ".tmp";
		PrintWriter output = new PrintWriter(outputName);
		String s = input.nextLine();
		while (input.hasNextLine()) {
			output.println(fix(s));
			s = input.nextLine();
			while (s.equals("")) {
				s = input.nextLine();
			}
			if (s.length() > 0) {
				s = s.substring(count);
			}
		}
		output.println(s);
		output.close();
		input.close();
		System.out.println(was.size());
	}

	static HashSet<Integer> was;

	private static String fix(String s) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i <s.length(); i++) {
			char t = s.charAt(i);
			if (t > 127) {
				System.err.println((int) t);
				was.add((int) t);
				t = 0;
			} else {
				sb.append(t);
			}
		}
		return sb.toString();
	}

}
