#[allow(unused_macros)]
macro_rules! my_write {
  ($writer:expr, $args:expr) => {
    $writer.write($args).unwrap()
  };
  ($writer:expr, $($args:expr),*) => {
    {
      let mut buf = Vec::new();
      $(buf.write($args).unwrap();)*
      $writer.write(&buf).unwrap()
    }
  };
}

use std::io::{ stdin, stdout, Write };

#[inline(always)]
fn abc153_c() {
  let stdin  = stdin();
  let stdout = stdout();
  let mut scanner = my::Scanner::with_capacity(12, stdin.lock());
  let mut writer  = stdout.lock();
  let mut itoa    = my::ItoA::with_capacity(10);

  let n = my::atoi::<usize>(scanner.read_until(my::SP));
  let k = my::atoi::<usize>(scanner.read_until(my::LF));
  if n < k {
    my_write!(writer, b"0\n");
    writer.flush().unwrap();
    return;
  }

  let mut vec = scanner.fold(n, my::SP, Vec::with_capacity(n), | mut v, s | {
    v.push(my::atoi::<u64>(s));
    v
  });
  vec.sort();

  let mut ans = 0;
  for i in 0..n - k {
    ans += vec[i]
  }

  my_write!(writer, itoa.from_u64(ans), b"\n");
  writer.flush().unwrap();
}

fn main() {
  abc153_c();
}

//------------------------------------------------------------------------
mod my {
  use std::ops::{ Add, Sub, Mul };

  #[allow(dead_code)]
  pub const SP: u8 = b' ';
  #[allow(dead_code)]
  pub const LF: u8 = b'\n';

  //----------------------------------------------------------------------
  #[allow(dead_code)]
  pub fn atoi<T>(s: &[u8]) -> T
    where T: Add<Output=T> +
             Sub<Output=T> +
             Mul<Output=T> +
             Default +
             From<u8> +
             ::std::fmt::Debug
  {
    let mut n = T::default();

    if s.is_empty() {
      return n;
    }

    match s[0] {
      b'+' => for b in &s[1..] { n = (n * T::from(10)) + T::from(b - b'0'); },
      b'-' => for b in &s[1..] { n = (n * T::from(10)) - T::from(b - b'0'); },
      _    => for b in &s[0..] { n = (n * T::from(10)) + T::from(b - b'0'); },
    }

    n
  }

  //----------------------------------------------------------------------
  macro_rules! pub_fn_ItoA_from_ty {
    ($($name:ident => $_type:ty),*) => {$(
      #[allow(dead_code)]
      #[allow(unused_comparisons)]
      #[inline(always)]
      pub fn $name(&mut self, mut n: $_type) -> &[u8] {
        self.buf.clear();
        if n == 0 {
          self.buf.push(b'0');
          return self.buf.as_slice();
        }

        let mut is_negative = false;
        if n < 0 {
          is_negative = true;
          n = (!n).wrapping_add(1);
        }

        while n > 0 {
          self.buf.push((n % 10) as u8 + b'0');
          n /= 10;
        }
        if is_negative {
          self.buf.push(b'-');
        }
        self.buf.reverse();
        self.buf.as_slice()
      }
    )*};
  }

  #[derive(Debug)]
  pub struct ItoA {
    buf: Vec<u8>,
  }

  impl ItoA {
    #[allow(dead_code)]
    #[inline(always)]
    pub fn with_capacity(cap: usize) -> Self {
      ItoA {
        buf: Vec::with_capacity(cap),
      }
    }

    pub_fn_ItoA_from_ty!(
      from_usize => usize,
      from_u8    => u8,
      from_u16   => u16,
      from_u32   => u32,
      from_u64   => u64,
      from_isize => isize,
      from_i8    => i8,
      from_i16   => i16,
      from_i32   => i32,
      from_i64   => i64
    );
  } // impl ItoA

  //----------------------------------------------------------------------
  #[derive(Debug)]
  pub struct Scanner<R> {
    reader: R,
    buf   : Vec<u8>,
  }

  impl<R> Scanner<R>
    where R: ::std::io::BufRead
  {
    #[allow(dead_code)]
    #[inline(always)]
    pub fn with_capacity(cap: usize, reader: R) -> Self {
      Scanner {
        reader: reader,
        buf   : Vec::with_capacity(cap),
      }
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn read_until(&mut self, delim: u8) -> &[u8] {
      self.buf.clear();
      let mut len = self.reader.read_until(delim, &mut self.buf).unwrap();
      if len == 0 {
        return self.buf.as_slice();
      }

      len -= 1;
      if self.buf[len] == delim {
        self.buf.truncate(len);
      }
      self.buf.as_slice()
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn for_each<F>(&mut self, n: usize, delim: u8, mut func: F)
      where F: FnMut(&[u8])
    {
      for _ in 0..n - 1 {
        func(self.read_until(delim));
      }
      func(self.read_until(LF))
    }

    #[allow(dead_code)]
    #[inline(always)]
    pub fn fold<B, F>(&mut self, n: usize, delim: u8, mut init: B, mut func: F) -> B
      where F: FnMut(B, &[u8]) -> B
    {
      for _ in 0..n - 1 {
        init = func(init, self.read_until(delim));
      }
      func(init, self.read_until(LF))
    }
  } // impl<R> Scanner<R>

} // mod my


Measured memory_bytes: 6396