#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  int a[n], b[k];
  for (int i = 0; i < n; i++) {
    a[i] = i + 1;
  }
  for (int j = 0; j < k; j++) {
    cin >> b[j];
  }
  int leader = 0;
  for (int j = 0; j < k; j++) {
    int steps = 0;
    for (int i = leader; i < n; i++) {
      if (a[i] != 0) {
        steps++;
      }
    }
    for (int i = 0; i < leader; i++) {
      if (a[i] != 0) {
        steps++;
      }
    }
    steps = b[j] % steps;
    if (steps == 0) {
      cout << a[leader] << " ";
      a[leader] = 0;
      bool flag = false;
      for (int c = leader + 1; c < n; c++) {
        if (a[c] != 0) {
          flag = true;
          leader = c;
          break;
        }
      }
      if (flag == false) {
        for (int c = 0; c < leader; c++) {
          if (a[c] != 0) {
            flag = true;
            leader = c;
            break;
          }
        }
        if (flag == false) {
          return 0;
        }
      }
    } else {
      for (int i = leader + 1; i < n; i++) {
        if (a[i] != 0) {
          if ((steps - 1) != 0) {
            steps--;
          } else {
            cout << a[i] << " ";
            a[i] = 0;
            bool flag = false;
            for (int c = i + 1; c < n; c++) {
              if (a[c] != 0) {
                flag = true;
                leader = c;
                break;
              }
            }
            if (flag == false) {
              for (int c = 0; c < i; c++) {
                if (a[c] != 0) {
                  flag = true;
                  leader = c;
                  break;
                }
              }
              if (flag == false) {
                return 0;
              }
            }
            steps--;
            break;
          }
        }
      }
      if (steps != 0) {
        for (int i = 0; i <= leader; i++) {
          if (a[i] != 0) {
            if ((steps - 1) != 0) {
              steps--;
            } else {
              cout << a[i] << " ";
              a[i] = 0;
              bool flag = false;
              for (int c = i + 1; c < n; c++) {
                if (a[c] != 0) {
                  flag = true;
                  leader = c;
                  break;
                }
              }
              if (flag == false) {
                for (int c = 0; c < i; c++) {
                  if (a[c] != 0) {
                    flag = true;
                    leader = c;
                    break;
                  }
                }
                if (flag == false) {
                  return 0;
                }
              }
              steps--;
              break;
            }
          }
        }
      }
    }
  }
  return 0;
}
