/*package whatever //do not write package name here */

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

public class Main {
	public static void main (String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		
		int k=s.nextInt();
		if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		}
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main (String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		
		int k=s.nextInt();
		if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		}
	}
} Main public static void main (String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		
		int k=s.nextInt();
		if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		}
	} main {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		
		int k=s.nextInt();
		if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		}
	} Scanner s=new Scanner(System.in); s new Scanner(System.in) int n=s.nextInt(); n s.nextInt() s.nextInt s int k=s.nextInt(); k s.nextInt() s.nextInt s if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		} k>n k n System.out.println(0) System.out.println System.out System System.out 0 {
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		} int a[]=new int[n]; a new int[n] n long sum=0; sum 0 for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {a[i]=s.nextInt();
		//sum+=a[i];
		    
		} {a[i]=s.nextInt();
		//sum+=a[i];
		    
		} a[i]=s.nextInt() a[i] a i s.nextInt() s.nextInt s Arrays.sort(a) Arrays.sort Arrays a for(int i=0;i<n-k;i++)
		sum+=a[i]; int i=0; int i=0; i 0 i<n-k i n-k n k i++ i++ i sum+=a[i]; sum+=a[i] sum a[i] a i System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main (String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		
		int k=s.nextInt();
		if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		}
	}
} public class Main {
	public static void main (String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		
		int k=s.nextInt();
		if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		}
	}
} Main
/*package whatever //do not write package name here */

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

public class Main {
	public static void main (String[] args) {
		Scanner s=new Scanner(System.in);
		int n=s.nextInt();
		
		int k=s.nextInt();
		if(k>n)
		System.out.println(0);
		else{
		int a[]=new int[n];
	long sum=0;
		for(int i=0;i<n;i++)
		{a[i]=s.nextInt();
		//sum+=a[i];
		    
		}
		Arrays.sort(a);
		for(int i=0;i<n-k;i++)
		sum+=a[i];
		
		
		
		System.out.println(sum);
		}
	}
}