#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
const long long INFF = 0x7fffffffffffffff;
const double pi = 3.141592653589793;
const double eps = 1e-8;
const long long mod = 1e9 + 7;
int a[105];
struct nodes {
  int id;
  int value;
  friend bool operator<(struct nodes a, struct nodes b) {
    return a.value < b.value;
  }
} node[105];
int main() {
  memset(a, 0, sizeof(a));
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) {
    node[i].id = i;
    node[i].value = i;
  }
  int cur = 1;
  for (int i = 0; i < k; i++) {
    int num = a[i] % (n - i);
    cur += num;
    if (cur > (n - i)) cur -= (n - i);
    cout << node[cur].id << ' ';
    node[cur].value = 1000;
    sort(node + 1, node + (n - i) + 1);
  }
  cout << endl;
  return 0;
}
