You came to the exhibition and one exhibit has drawn your attention. It consists of n stacks of blocks, where the i-th stack consists of a_i blocks resting on the surface.

The height of the exhibit is equal to m. Consequently, the number of blocks in each stack is less than or equal to m.

There is a camera on the ceiling that sees the top view of the blocks and a camera on the right wall that sees the side view of the blocks.

<image>

Find the maximum number of blocks you can remove such that the views for both the cameras would not change.

Note, that while originally all blocks are stacked on the floor, it is not required for them to stay connected to the floor after some blocks are removed. There is no gravity in the whole exhibition, so no block would fall down, even if the block underneath is removed. It is not allowed to move blocks by hand either.

Input

The first line contains two integers n and m (1 ≤ n ≤ 100 000, 1 ≤ m ≤ 10^9) — the number of stacks and the height of the exhibit.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ m) — the number of blocks in each stack from left to right.

Output

Print exactly one integer — the maximum number of blocks that can be removed.

Examples

Input

5 6
3 3 3 3 3


Output

10

Input

3 5
1 2 4


Output

3

Input

5 5
2 3 1 4 4


Output

9

Input

1 1000
548


Output

0

Input

3 3
3 1 1


Output

1

Note

The following pictures illustrate the first example and its possible solution.

Blue cells indicate removed blocks. There are 10 blue cells, so the answer is 10.

<image>
import java.util.*;
import java.math.*;
import java.io.*; 
 public class Main{

    public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
     static FastReader scan = new FastReader();
    
static long mod=1000000000;
static int []dx={1,-1,0,0};
static int []dy={0,0,1,-1};
static int dx_8[]={1,1,1,0,0,-1,-1,-1};
static int dy_8[]={-1,0,1,-1,1,-1,0,1};
 static long powMod(long base, long exp, long mod) {
       if (base == 0 || base == 1) return base;
       if (exp == 0) return 1;
       if (exp == 1) return base % mod;
       long R = powMod(base, exp/2, mod) % mod;
       R *= R;
       R %= mod;
       if ((exp & 1) == 1) {
           return base * R % mod;
       }
       else return R % mod;
   }

     static long gcd(long a, long b) {
    if(a!=0&&b!=0)
        while((a%=b)!=0&&(b%=a)!=0);
    return a^b;
}  

static boolean prime[];
   static void sieve(int n) 
    { 
        
        prime = new boolean[n+1]; 
        for(int i=0;i<n;i++) 
            prime[i] = true; 
          
        for(int p = 2; p*p <=n; p++) 
        { 
           
            if(prime[p] == true) 
            { 
                
                for(int i = p*p; i <= n; i += p) 
                    prime[i] = false; 
            } 
        } 
    } 
    static boolean are(int i,int j)
{
    int n=i^j;
    return (n&(n-1))==0;
}     
static long binaryToDecimal(long n)
    {
        long num = n;
        long dec_value = 0;
 
        // Initializing base
        // value to 1, i.e 2^0
        long base = 1;
 
        long temp = num;
        while (temp > 0) {
            long last_digit = temp % 10;
            temp = temp / 10;
 
            dec_value += last_digit * base;
 
            base = base * 2;
        }
 
        return dec_value;
    }


static LinkedList<Integer>edges[];
static int cnt=0;
static boolean vis[]=new boolean[(int)4e5+5];
static boolean cy=false;
static int arr[];
static int n,k;
static boolean ok(int x)
{
    int j=0;
    int l=0;
    int i=0;
    int ks=0;
for(;i<n&&ks<k;ks++)
{
    //int kk=i;
    //l++;
    //out.println("FUCK");
    //out.println(x);
    int h=arr[i];
    while(i<n-1&&h+2*x>=arr[i+1])
        i++;
    i++;
  //  if(kk>=n||kk==n-1){
      //  out.println("FUCK");
    //    break;
    //}
   /* if(kk==i){
        out.println("YES "+i);
        return false;
    }*/
    
//    i=kk;

//l++;
}
if(i>=n){
   out.println(l);
    return true;
}
//out.println(l);
return false;
}
static long LCM(long a,long b){
    return (Math.abs(a*b))/gcd(a,b);
   }
public static void main(String[] args)  throws Exception 
{
   // java.util.Scanner scan=new java.util.Scanner(new File("convention.in"));
//PrintWriter out = new PrintWriter (new FileWriter("convention.out"));
    //1 0 1 0
  //  scan=new FastReader("maxcross.in");
//out = new PrintWriter ("maxcross.out");
    int tt=1;
//tt=scan.nextInt();
   outer:while(tt-->0)
   {
 int n=scan.nextInt(),m=scan.nextInt();
 long arr[]=new long[n];
 long sum=0;
 for(int i=0;i<n;i++){
 arr[i]=scan.nextLong();
sum+=arr[i];
}
if(n==1)
{
    out.println(0);
    out.close();
    return;
}
//out.println(sum);
 Arrays.sort(arr);
 long res=0;
 long prev=0;
 for(int i=0;i<n;i++)
 {
    
     res+=1;
     if(arr[i]>prev)
        prev++;
 }
 res+=(arr[n-1]-prev);
 out.println(sum-res);   

  
    }

out.close();
//do something instead of nothing
}
 
static long power(long a,long b)
{
    if(b==0)
        return 1;
    long res=power(a,b/2);
    if(b%2==1)
        return res*res*a;
    else return res*res;
}
  
    static long power(long a,long b,long mod)
{
    if(b==0)
        return 1;
    long res=power(a,b/2,mod);
    res=(res*res)%mod;
    if(b%2==0)
        return res;
    else 
        return (res*a)%mod;
}
   public static class FastReader {
        BufferedReader br;
        StringTokenizer root;
        
 
        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        FastReader(String filename)throws Exception
        {

            br=new BufferedReader(new FileReader(filename));
        }
 
        String next() {
            while (root == null || !root.hasMoreTokens()) {
                try {
                    root = new StringTokenizer(br.readLine());
                } catch (Exception addd) {
                    addd.printStackTrace();
                }
            }
            return root.nextToken();
        }
 
        int nextInt() {
            return Integer.parseInt(next());
        }
 
        double nextDouble() {
            return Double.parseDouble(next());
        }
 
        long nextLong() {
            return Long.parseLong(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (Exception addd) {
                addd.printStackTrace();
            }
            return str;
        }
         public int[] nextIntArray(int arraySize) {
            int array[] = new int[arraySize];
 
            for (int i = 0; i < arraySize; i++) {
                array[i] = nextInt();
            }
 
            return array;
        }

        public boolean ready() throws IOException {return br.ready();}
}
 public static class Pair implements Comparable<Pair>{
        public long x, y,z,d;
        public Pair(long x1, long y1) {
            x=x1;
            y=y1;
        }
         public Pair(long x1, long y1,long z,long d) {
            x=x1;
            y=y1;
            this.z=z;
            this.d=d;
        }
        @Override
        public int hashCode() {
            return (int)(x + 31 * y);
        }
        public String toString() {
            return x + " " + y;
        }
        @Override
        public boolean equals(Object o){
            if (o == this) return true;
            if (o.getClass() != getClass()) return false;
            Pair t = (Pair)o;
            return t.x == x && t.y == y;
        }
        public int compareTo(Pair o){
            return (int)(x-o.x);
        }

}
static class Edge{
        int d,w;
        Edge(int d,int w)
        {
            this.d=d;
            this.w=w;
        }
    }
    //union find by rank 


   



}