#include <bits/stdc++.h>
using namespace std;
int n, m, pos, x, N;
bool usd[1000];
int main() {
  cin >> n >> m;
  pos = 1;
  N = n;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    x %= N;
    for (; x > 0;) {
      pos++;
      if (pos > n) pos %= n;
      if (usd[pos] == 0) x--;
    }
    usd[pos] = 1;
    --N;
    cout << pos << ' ';
    for (; usd[pos] == 1;) {
      pos++;
      if (pos > n) pos %= n;
    }
  }
}
