#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, S, T, a[N], st[N], ans[N];
map<int, bool> s;
struct cd {
  int grp, id, seat;
  bool operator<(const cd &o) const {
    return grp == o.grp ? seat < o.seat : grp < o.grp;
  }
} sta[N];
int exgcd(int a, int b, int &x, int &y) {
  if (!b) {
    x = 1, y = 0;
    return a;
  }
  int g = exgcd(b, a % b, x, y), x0 = x, y0 = y;
  x = y0, y = x0 - y0 * (a / b);
  return g;
}
int main() {
  scanf("%d%d", &T, &n), S = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]), a[i] %= T, S += a[i];
    if (S >= T) S -= T;
    st[i] = i == 1 ? 0 : st[i - 1] + a[i];
    if (st[i] >= T) st[i] -= T;
  }
  int x, y, step = S, cir = exgcd(step, T, x, y), num = T / cir, cnt = 0;
  s.clear(), memset(ans, 0, sizeof ans);
  for (int i = 1; i <= n; ++i) {
    if (!s[st[i]])
      s[st[i]] = 1;
    else
      continue;
    sta[++cnt].grp = st[i] % cir, sta[cnt].id = i;
    sta[cnt].seat = 1ll * x * ((st[i] - (st[i] % cir)) / cir) % num;
    sta[cnt].seat = (sta[cnt].seat + num) % num;
  }
  sort(sta + 1, sta + 1 + cnt);
  for (int i = 1, j; i <= cnt; i = j + 1) {
    for (j = i; j < cnt && sta[j + 1].grp == sta[i].grp; ++j)
      ;
    for (int k = i; k < j; ++k) ans[sta[k].id] = sta[k + 1].seat - sta[k].seat;
    ans[sta[j].id] = sta[i].seat - sta[j].seat + num;
    if (j == cnt) break;
  }
  for (int i = 1; i <= n; ++i) printf("%d%c", ans[i], i < n ? ' ' : '\n');
  return 0;
}
