#include #include using namespace std; using ll = long long int; int main(void){ int n, m, atmp; cin >> n >> m; int a[m]; for (int i = 0; i < m; i ++){ cin >> atmp; a[i] = atmp - 1; } int now = 0; for (int i = m - 1; i >= 0; i--){ if (now == 0){ now = a[i]; } else if (now < a[i]){ now --; } } cout << now + 1 << endl; return 0; }