#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int a[N];
int main() {
  int n, k;
  while (cin >> n >> k) {
    for (int i = 1; i <= k; i++) cin >> a[i];
    int sum = 0;
    int vis[1000];
    memset(vis, 0, sizeof(vis));
    int x = 0;
    int qq = n;
    for (int i = 1; i <= k; i++) {
      int flag = 0;
      while (a[i] > 0) {
        a[i] %= qq;
        if (a[i] <= 0) a[i] += qq;
        if (flag == 0) {
          int q = (x + 1);
          if (q == n + 1) q = 1;
          while (vis[q]) {
            q++;
            if (q == n + 1) q = 1;
          }
          for (int j = q; j <= n; j++) {
            if (!vis[j]) {
              x = j;
              a[i]--;
              if (a[i] == 0) break;
            }
            flag++;
          }
        } else {
          for (int j = 1; j <= n; j++) {
            if (!vis[j]) {
              x = j;
              a[i]--;
              if (a[i] == 0) break;
            }
          }
        }
      }
      x += 1;
      if (x == n + 1) x = 1;
      while (vis[x] == 1) {
        x++;
        if (x == n + 1) x = 1;
      }
      vis[x] = 1;
      cout << x << " ";
      qq--;
    }
    cout << endl;
  }
  return 0;
}
