#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
const int N = 1010;
int n,m;
int a[N];
int main()
{
cin>>n>>m;
for(int i = 1; i<=n; i++) cin>>a[i];
a[n+1] = m;
int k = 0;
int sum = 0;
for(int i = 0; i<=n; i++)
{
for(int j = a[i]; j<a[i+1]; j++)
sum+=k;
k++;
}
cout<<sum;
return 0;
}