#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     int a[k];     for (int i = 0; i < k; i++) cin >> a[i];     list<int> leader;     for (int i = 1; i <= n; i++) leader.insert(leader.end(), i);     int l = 1;     int i = 0;     int begin = 0;     while (k--) {       l = (leader.size() + a[i] + begin) % leader.size();       list<int>::iterator pnlist = leader.begin();       advance(pnlist, l);       if (k == 0)         cout << *pnlist << endl;       else         cout << *pnlist <<    ;       leader.erase(pnlist);       begin = l;       i++;     }   }   