#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};
int biton(int n, int pos) { return n = n | (1 << pos); }
int bitoff(int n, int pos) { return n = n & ~(1 << pos); }
bool bitcheck(int n, int pos) { return (bool)(n & (1 << pos)); }
inline int nxt() {
  int a;
  scanf("%d", &a);
  return a;
}
inline long long int NXT() {
  long long int a;
  scanf("%lld", &a);
  return a;
}
int mark[200];
int next(int leader, int n) {
  leader++;
  if (leader == n + 1) leader = 1;
  while (mark[leader] != 0) {
    leader++;
    if (leader == n + 1) leader = 1;
  }
  return leader;
}
int main() {
  int n = nxt(), m = nxt();
  int leader = 1;
  for (int i = 0; i < m; i++) {
    int x = nxt() % (n - i);
    int cnt = 0;
    for (int j = 0; j < x; j++) {
      leader = next(leader, n);
    }
    cout << leader << ' ';
    mark[leader] = 1;
    leader = next(leader, n);
  }
}
