func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, a[100010];   long long t;   int main() {     cin >> n >> m;     a[0] = 1;     for (int i = 1; i <= m; i++) {       cin >> a[i];       if (a[i] > a[i - 1]) t += (a[i] - a[i - 1]);       if (a[i] < a[i - 1]) t += (n - a[i - 1] + a[i]);     }     cout << t;   }   