#include <bits/stdc++.h>   using namespace std;   template <class T, class S>   ostream& operator<<(ostream& os, const pair<T, S>& v) {     return os <<  (  << v.first <<  ,   << v.second <<  ) ;   }   template <class T>   ostream& operator<<(ostream& os, const vector<T>& v) {     os <<  [ ;     for (int i = int(0); i <= int((static_cast<int>((v).size())) - 1); ++i) {       if (i) os <<  ,  ;       os << v[i];     }     return os <<  ] ;   }   template <class T>   bool setmax(T& _a, T _b) {     if (_a < _b) {       _a = _b;       return true;     }     return false;   }   template <class T>   bool setmin(T& _a, T _b) {     if (_b < _a) {       _a = _b;       return true;     }     return false;   }   template <class T>   T gcd(T _a, T _b) {     return _b == 0 ? _a : gcd(_b, _a % _b);   }   int main() {     int n, k;     cin >> n >> k;     vector<int> a(n);     iota((a).begin(), (a).end(), 0);     int cur = 0;     while (k--) {       int x;       cin >> x;       int next = (cur + x) % static_cast<int>((a).size());       cout << a[next] + 1 <<    ;       a.erase(a.begin() + next);       cur = next % static_cast<int>((a).size());     }     cout << endl;     return 0;   }   