#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / (gcd(a, b)));
}
template <class T>
inline T gcd(T a, T b) {
  if (a < 0) return gcd(-a, b);
  if (b < 0) return gcd(a, -b);
  return (b == 0) ? a : gcd(b, a % b);
}
template <class T1>
void deb(T1 e) {
  cout << e << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
int main() {
  int i, j, n, k, cnt, no, st;
  vector<int> inp, opt, tem, rn;
  cin >> n >> k;
  for (i = 0; i < k; i++) {
    cin >> no;
    rn.push_back(no);
  }
  int flag[n + 5];
  memset(flag, 1, sizeof(flag));
  for (i = 1; i <= n; i++) {
    inp.push_back(i);
    tem.push_back(i);
  }
  st = 1;
  for (i = 0; i < k; i++) {
    cnt = 1;
    if (rn[i] > (int)inp.size()) {
      if (rn[i] % (int)inp.size() == 0)
        rn[i] = (int)inp.size();
      else
        rn[i] = rn[i] % (int)inp.size();
    }
    for (j = st;; j++) {
      if (cnt == rn[i]) {
        opt.push_back(inp[j]);
        flag[inp[j]] = 0;
        if (j == (int)inp.size() - 1)
          st = 1;
        else if (j == (int)inp.size() - 2)
          st = 0;
        else
          st = j + 1;
        break;
      }
      if (j == (int)inp.size() - 1) j = -1;
      cnt++;
    }
    inp.clear();
    for (j = 0; j < (int)tem.size(); j++) {
      if (flag[tem[j]]) inp.push_back(tem[j]);
    }
  }
  for (i = 0; i < (int)opt.size(); i++) {
    if (i != 0) cout << " ";
    cout << opt[i];
  }
  return 0;
}
