#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n;
  cin >> k >> n;
  int a[k];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += min(a[i], a[i + 1]);
  }
  cout << sum << endl;
}
