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