import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    int N, K;
    readf("%d %d\n", &N, &K);
    auto g = sort(sort(readln.split.to!(int[])).group.map!(g => g[1]).array);
    g[0..max(0,cast(long)g.length-K)].sum.writeln;
}

