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

public class invaders_rs implements Runnable {
	private BufferedReader in;
	private PrintWriter out;
	
	private void check(boolean expr, String msg) {
		if (!expr) {
			throw new Error(msg);
		}
	}
	
	private void checkBounds(int n, int low, int hi, String nStr) {
		check((low <= n) && (n <= hi), nStr + " is not in [" + low + ", " + hi + "]");
	}
	
	private void solve() throws IOException {
		StringTokenizer st = new StringTokenizer(in.readLine());
		int n = Integer.parseInt(st.nextToken());
		int p = Integer.parseInt(st.nextToken());
		checkBounds(n, 1, 100, "n");
		checkBounds(n, 1, 100, "p");
		st = new StringTokenizer(in.readLine());
		int sum = 0;
		for (int i = 0; i < n; i++) {
			int a = Integer.parseInt(st.nextToken());
			checkBounds(a, 1, 100, "a[i]");
			sum += a;
		}
		out.println(sum + n - 1 + Math.min(n - p, p - 1));
	}
	
	public static void main(String[] args) {
		new Thread(new invaders_rs()).start();
	}

	public void run() {
		String problem = getClass().getName().split("_")[0];
		try {
			in = new BufferedReader(new FileReader(new File(problem + ".in")));
			out = new PrintWriter(new File(problem + ".out"));
			solve();
			in.close();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
