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.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class q54 {
	static final double EPS = 1e-9;

	static pair[] x = new pair[3];
	static int ac1 = -1;
	static int ac2 = -1;
	static int noox = -1;
	static int nooy = -1;
	static int same = -1;
	static int grid[][] = new int[1001][1001];
	static long wx1 = 0, wy1 = 0;
	static long wx2 = 0, wy2 = 0;
	static long bx1 = 0, by1 = 0;
	static long bx2 = 0, by2 = 0;
	static long overlappingWS = -1, overlappingWE = -1;
	static long overlappingHS = -1, overlappingHE = -1;

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		int x [] = new int [n];
		for(int i=0;i<n;i++) {
			x[i]=sc.nextInt();
		}
		
		Arrays.sort(x);
		long sum=0;
		long store=0;
		if(x[0]>0) {
			 store=x[0]-1;
		}
		for(int i=1;i<n;i++) {
		  if(x[i]>x[i-1]) {	
			sum+=x[i-1];
			store+=x[i]-x[i-1]-1;
		  }else {
				sum+=x[i-1]-1;
				if(store>0) {
					store--;
					sum++;
				}
		  }
		}
		System.out.println(sum);
		
	}

	static long incWhite(long horiWfrom, long horiWto, long verWfrom, long verWto) {
		long tot = 0;
		tot += horiWto - horiWfrom + 1;
		tot /= 2;
		tot *= (verWto - verWfrom + 1);
		if ((horiWto - horiWfrom + 1) % 2 != 0) {
			if ((even(horiWto) & even(verWfrom)) || (!even(horiWto) & !even(verWfrom))) {
				// white at base
				tot += (verWto - verWfrom + 1) / 2;
			} else {
				tot += (verWto - verWfrom + 1) / 2;
				if ((verWto - verWfrom + 1) % 2 != 0)
					tot++;
			}
		}
		return tot;
	}

	static long incblack(long horiWfrom, long horiWto, long verWfrom, long verWto) {
		long tot = 0;
		tot += horiWto - horiWfrom + 1;
		tot /= 2;
		tot *= (verWto - verWfrom + 1);
		if ((horiWto - horiWfrom + 1) % 2 != 0) {
			if ((even(horiWto) & even(verWfrom)) || (!even(horiWto) & !even(verWfrom))) {
				// white at base
				tot += (verWto - verWfrom + 1) / 2;
				if ((verWto - verWfrom + 1) % 2 != 0)
					tot++;
			} else {
				tot += (verWto - verWfrom + 1) / 2;
			}
		}
		return tot;
	}

	static boolean even(long k) {
		return k % 2 == 0;
	}

	static long getoverlappinghori(long horiBfrom, long horiBto, long horiWfrom, long horiWto) {
		if (horiBfrom >= horiWfrom && horiBto <= horiWto) {
			overlappingWS = horiBfrom;
			overlappingWE = horiBto;
			return horiBto - horiBfrom + 1;
		}
		if (horiWfrom >= horiBfrom && horiWto <= horiBto) {
			overlappingWS = horiWfrom;
			overlappingWE = horiWto;
			return horiWto - horiWfrom + 1;
		}
		if (horiBfrom >= horiWfrom && horiBto >= horiWto) {
			overlappingWS = horiBfrom;
			overlappingWE = horiWto;
			return horiWto - horiBfrom + 1;
		}
		if (horiWfrom >= horiBfrom && horiWto >= horiBto) {
			overlappingWS = horiWfrom;
			overlappingWE = horiBto;
			return horiBto - horiWfrom + 1;
		}

		return 0;
	}

	static long getoverlappingver(long horiBfrom, long horiBto, long horiWfrom, long horiWto) {
		if (horiBfrom >= horiWfrom && horiBto <= horiWto) {
			overlappingHS = horiBfrom;
			overlappingHE = horiBto;
			return horiBto - horiBfrom + 1;
		}
		if (horiWfrom >= horiBfrom && horiWto <= horiBto) {
			overlappingHS = horiWfrom;
			overlappingHE = horiWto;
			return horiWto - horiWfrom + 1;
		}
		if (horiBfrom >= horiWfrom && horiBto >= horiWto) {
			overlappingHS = horiBfrom;
			overlappingHE = horiWto;
			return horiWto - horiBfrom + 1;
		}
		if (horiWfrom >= horiBfrom && horiWto >= horiBto) {
			overlappingHS = horiWfrom;
			overlappingHE = horiBto;
			return horiBto - horiWfrom + 1;
		}

		return 0;
	}

	static void shuffle(int[] a) {
		int n = a.length;
		for (int i = 0; i < n; i++) {
			int r = i + (int) (Math.random() * (n - i));
			int tmp = a[i];
			a[i] = a[r];
			a[r] = tmp;
		}
	}

	public static class pair implements Comparable<pair> {

		int x, y;

		pair(int a, int b) {
			x = a;
			y = b;
		}

		// desc version
		public int compareTo(pair p) {
			if (Math.abs(x - p.x) > EPS)
				return x < p.x ? 1 : -1;
			if (Math.abs(y - p.y) > EPS)
				return y < p.y ? 1 : -1;
			return 0;
		}
	}

	public static class kair implements Comparable<kair> {

		ArrayList<Integer> ar;
		int s;

		kair(ArrayList<Integer> a, int b) {
			ar = a;
			s = b;
		}

		// desc version
		public int compareTo(kair p) {
			if (Math.abs(s - p.s) > EPS)
				return s < p.s ? 1 : -1;

			return 0;
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public long nextlong() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			long res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}